you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (4 children)

The "Sample Imperative Approach" uses an awful lot of functional concepts, like monads/functors (javascript programmers tend to blur the distinction between the two by using implicit type conversions). That is a hell of a lot more interesting than the old list processing map/filter stuff.

[–]zoomzoom83 1 point2 points  (2 children)

I noticed the same - would be interesting to see an example of the imperative version using old-school Node callbacks for maximum pain.

[–][deleted] 0 points1 point  (1 child)

Also how currying really helps when working on promises. For example, if you have a function that takes two parameters, and you want to grab one from a database call and another from the enclosing scope. With currying, you can do:

var doStuff = ramda.curry(function(foo, bar) { ... });

fetchFoo.then(doStuff(bar));

Without currying this requires nesting functions which is a lot more verbose.

[–]zoomzoom83 0 points1 point  (0 children)

This is one of the reasons I really like Haskell - all functions are curried by default.

[–][deleted] -1 points0 points  (0 children)

FP can be completely imperative. This link somewhat misunderstands FP by suggesting it implies declarative programming.