Haskell Me Baby

On my rode to becoming a coding guru, I’ve decided to learn Haskell. This will be my first time learning a functional language and it’s been a pretty interesting experience so far. In functional programming variables are immutable, which means when a variable has been set to a certain value it can’t be changed to something else. To someone who has programmed in mostly C like languages this feels like a handicap, but it starts to make things interesting. It takes a little more time to think of a solution to a problem, but it’s fun.

Two resources I’ve used to learn Haskell have been learnyouahaskell.com and en.wikibooks.org/wiki/Haskell. Both are good, but the former is easier to understand so far.

Some example code of Haskell is below. The first function is fibonacci and takes a single number as an argument. The second function is factorial and only takes a single number as an argument. If you look at the factorial function, which is not the best implementation, it seems to define factorial in two ways, which is pretty awesome.

 

Leave a Reply