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.

 

3 thoughts on “Haskell Me Baby

  1. Learning a functional programming language like Haskell is indeed a fascinating journey. The concept of immutable variables challenges traditional programming paradigms and forces a different way of thinking. Solving problems in Haskell requires more effort but also brings a sense of accomplishment. Exploring examples like Fibonacci and factorial functions helps understand the elegance of functional programming. Why does Haskell define the factorial function in two ways, and how does that impact its efficiency?

  2. Learning Haskell has been a unique journey, especially coming from C-like languages. Immutable variables force a different way of thinking, which is both challenging and rewarding. Solving problems in Haskell feels like solving puzzles, and it’s quite enjoyable. The example code shows how elegant and concise functional programming can be. How does the concept of immutability improve code reliability in practice?

Leave a Reply