Hacker News new | ask | show | jobs
by josh-j 4849 days ago
It is different and difficult. I think that's because functional programming isn't simply a sideways step from imperative programming, but is instead a level of abstraction higher than imperative programming.

Hofstadter says analogy is the core of cognition. We tie unknown things to known things to understand them, and I think that's why you get all these bad analogies where people try to tie the more abstract concepts of fp like monads to everyday things ( "monads are like burritos," for example).

And this really doesn't make sense because monads and such are pure abstractions. How do you tie a pure abstraction to something concrete? It's like saying zero is like a burrito.

The better analogies tie pure abstractions like monads and arrows to other abstractions that you already understand. For instance, Odersky trains you by iteratively refactoring imperative Scala code into more functional code, and thereby gradually carrying you up the ladder of abstraction.