|
|
|
|
|
by empthought
4573 days ago
|
|
This isn't a question of "my style" -- zsombor's notation is objectively better. It achieves the same results with fewer tokens and less intellectual overhead. The difference between "functional" and "procedural" style here is nothing more than monadic bind operator vs do-notation, but what you have above or in the initial response is nothing like that. Also I'm not sure "arrows" -- http://www.haskell.org/haskellwiki/Arrow -- means what you think it means in the context of functional programming? It's not sugar for `function(){}`... |
|
As for style, using combinators is usually considered to be specific to functional programming, right?
IMO the interesting part is how the terse arrow function syntax in ES6 puts combinators on the same level of expressiveness as everything else. Contrast to ES5 you have to use the awkward `return function() {}` syntax, and you have to do something similar in go - `return func (param type) type { ... }`
Both styles are now almost equally terse and you can pick either depending whether you feel its more appropriate in the given situation.
Also: https://gist.github.com/Gozala/7242467