DEV Community

Discussion on: Functional vs Imperative Patterns in JavaScript

Collapse
 
avalander profile image
Avalander
reduceWhile (() => lte3) (add) (0) (values)

This almost looks like lisp, I like it ❤️

Collapse
 
joelnet profile image
JavaScript Joel

One trick I learned recently to making curried functions readable is to format them with spaces between the parens. I live this style :

I also have eslint-config-mojiscript to enforce this with eslint!

Cheers!

Collapse
 
avalander profile image
Avalander

Yeah, I add the spaces between the parenthesis too, but I don't curry all functions by default, only when I need so to do function composition.

Thread Thread
 
joelnet profile image
JavaScript Joel

That was one requirement of MojiScript, all functions must be curried. When every function is curried, every function can be composed!

There are also no callbacks. Every callback-style function must be promisified.

Cheers!