Haskell

Haskell is a lazy evaluated purely functional programing language. This means that values are not evaluated until they are used, and the language focuses on functions rather than objects. At first glance lazy evaluation may seem meaningless; however, it means that you can do things like construct an infinitely large list as long as you only use finite elements and never print them. This is useful in mathematics, and has numerous applications when building algorithms. Programing languages such as Java and C++ are object oriented, as you use global variables and define object that have functions. In object oriented programing, a function can return a value that depends on factors other than arguments, or it can even not return a value at all. In functional programing, functions are like they are in math; you get exactly one output for each set of inputs. This means that anytime in your code that you call the same function with the same arguments, you will get the same result. The lack of objects and nature of functions in functional programing languages makes you think about coding in an entirely different way.

Haskell is the first functional programing language that I have started learning, and I can see why it builds character. Haskell allows you to build functions that act on other functions, and the syntax makes it seem like you are writing math rather than code. To put all of the numbers from 1 to 100 in an array and then sum the values in Java, you would run code that looks something like this:

int [] arr = new int [101];
for(int i = 1; i < 101; i++){
	arr[i]=i;
}
int sum = 0;
for(int i = 0; i < arr.length; i++){
	sum+=arr[i];
}
System.out.println(sum);

Now to do the same thing in Haskell, the code would look something like this:

let arr = [1..100]
foldr (+) 0 arr

The let command tells us that we are defining arr to be the set of numbers from 1 to 100. Foldr is a function that takes a function, an initial value, and a list. It then applies the function to the array, starting with the initial value. As you can see, Haskell can be a much more elegant language when dealing with mathematical applications. Even outside of the field of mathematics, haskell probably has its applications. In terms of run time, it is not a very fast language, but there are many functional programing languages that share many traits with Haskell, such as ocaml that are just as fast as C++. In all, functional programing can make you think about coding differently, and is something that I am looking forward to learning more about.