Skip to content

Haskell

sameerg edited this page May 29, 2011 · 1 revision

@Haskell function I failed to learn Haskell approximately 2 times before finally grasping it because it all just seemed too weird to me and I didn't get it. But then once it just "clicked" and after getting over that initial hurdle, it was pretty much smooth sailing.


source


Notes

  • In purely functional programming you don't tell the computer what to do as such but rather you tell it what stuff is[unlike ctrl flowes of imperative cpp types]
  • build more complex functions by gluing simple functions together.

Say you have an immutable list of numbers xs = [1,2,3,4,5,6,7,8] and a function doubleMe which multiplies every element by 2 and then returns a new list. If we wanted to multiply our list by 8 in an imperative language and did doubleMe(doubleMe(doubleMe(xs))),

  • Haskell is statically typed. When you compile your program, the compiler knows which piece of code is a number, which is a string and so on.

Clone this wiki locally