4 ms·
Ramda actually uses data as the last parameter usually, whereas lodash has it as the first. However, I agree, the readme doesn't quite show the full power of T
by quinnirill 11y ago
Ramda actually uses data as the last parameter usually, whereas lodash has it as the first.
However, I agree, the readme doesn't quite show the full power of Trine. Trine has `partial`, which allows you to do partial application as so: `parseInt::partial(_)`, that would create a function that acts as parseInt but only takes one argument. This is in sync with the partial application syntax proposal: https://gist.github.com/anonymous/5c4f6ea07ad3017d61be https://gist.github.com/anonymous/5c4f6ea07ad3017d61be
The rest of the functional goodness, such as autocurrying are still undecided upon because in my personal experience autocurrying in JS is awkward and leads to bugs that are hard to debug. I'm also considering compose and a combination of compose and partial (e.g. apply a function to a parameter at a certain place), but again subjectively, composing functions like that has reduced the readability of codebases. JS already has first class functions which allows composition pretty easily, the only problem is that it's overtly verbose - I'm still hoping to see the single arrow function land in JS some day. :)
- notNow 11y agoMay I ask what do you mean by "single arrow function"? Do you mean thin arrow fn(s)?
- quinnirill 11y agoYes, sorry, thin arrow, not single - `() -> this.foo()` for function expressions and possibly even `let/const fn () -> this.foo()` for declarations.
- notNow 11y agoExcuse my ignorance but I only have experience in JS and not any other "advanced" or well-established programming langs, how's thin arrow syntax gonna fix this prob that fat arrow can't?
- asolove 11y agoFat arrow functions have lexical this: this inside the function is bound to what it was outside. Thin arrow functions have a dynamic this, determined by how they are called. Because the library relies on dynamic this as the place where the data is sent, fat arrow syntax isn't useful with it.
- notNow 11y agoThanks for the explanation.
- braythwayt 11y agoWhoops, my mistake, I meant to say last parameter, which is exactly its point. I recall discussing this with the authors at length, because allong.es usues a similar strategy with functions named ___With, e.g. mapWith, filterWith.
- jdd 11y agolodash-fp is a thin layer over lodash enabling auto-curried, data last methods – https://www.npmjs.com/package/lodash-fp https://www.npmjs.com/package/lodash-fp