5 ms·
why use map (-> it.length > x), list map (call \toUpperCase), 'haha' for functions with only one free variable? IMHO it would be prettier to have som
by riffraff 14y ago
why use
map (-> it.length > x), list
map (call \toUpperCase), 'haha'
for functions with only one free variable?
IMHO it would be prettier to have something like scala's _
map (_.length > x), list
map (_.toUpperCase), 'haha'
i.e. automatically build a closure when _ is used eithout the need for additional anonymous function syntax
- quarterto 14y agoThey discussed this, and decided: a) partially-applied operators fills some of the gap, and b) they're far too complicated to implement. https://github.com/gkz/LiveScript/issues/19 https://github.com/gkz/LiveScript/issues/19 https://github.com/taku0/placeholder_syntax_for_coffeescript/blob/master/src/placeholder.coffee https://github.com/taku0/placeholder_syntax_for_coffeescript...
- riffraff 14y agoah, thanks, I missed partially applied operators. But then, it seems easy to do it with single method calls too, e.g. map (.length) x rather than map (call \length) x does not fit more complex usage, but it's a tiny improvement I'd think
- GeZe 14y agoThis is an interesting idea - I will look into it. It does not seem to conflict with the current syntax. Thanks for the suggestion!
- adrusi 14y agoI'm not a big fan of scala's _ operator. I find it a poor decision from a language design perspective for _.method(param) to be a function, but for a.method(param) to not be a function (unless of course method returns a function) It also doesn't nest properly