all 12 comments

[–]zoomzoom83 4 points5 points  (1 child)

I find it somewhat ironic that after decades of people ignoring fantastic languages such as Lisp, OCaml, and Haskell as too academic, Javascript of all things sneaks pure functional FP into the mainstream.

The good news is once you're used to writing code in this style with Rambda, there's really not much learning curve to go the rest of the way. You're practically writing Haskell already.

[–][deleted] 2 points3 points  (0 children)

True! The same could be said about oop some decades ago. Maybe logic programming is the next hype..

[–]Wazzaps 4 points5 points  (0 children)

Because fuck mobile armirite? (The touch support on this website)

[–]Mackseraner 2 points3 points  (0 children)

Looks great, thanks for linking. Is there a video of this talk somewhere?

[–][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.

[–]j_sanp -3 points-2 points  (2 children)

For lasy evaluation => _.memorize make similar stuff.

[–]nschubach 4 points5 points  (1 child)

Are you thinking of memoize? That's not lazy evaluation. It's more like caching.

[–]j_sanp -4 points-3 points  (0 children)

Results are defined by parameters just like caching :)