Curried functions
liorean
liorean at gmail.com
Sat Oct 17 03:41:32 UTC 2015
On 17 Oct 2015 04:48, "Yongxu Ren" <renyongxu at gmail.com> wrote:
>
> How about we use a different approach?
>
> Instead of allowing ```a(b)(c)``` for ```let a = (b,c) => b+c;```,
>
> Maybe we can use ```a(b,c)``` for ```let a = b => c => b + c```?
Would that do any of the useful stuff you could reasonably want either
currying or partial application for, though? I mean the main use is that it
allows us to do
let d=a(b);
...
d(c);
And I don't really see how your desugaring a single multiple argument
application into several single parameter curried functions allows that
usefulness.
It's the multiple applications to fill single parameter list thing that is
the most useful part of it, mostly as it allows caching the closure at any
step for reuse, not single application to fill multiple sequential single
parameter lists. Also, consider rest parameters, defaults etc. and whether
doing what you want for the simple example case would have weird or
possibly ambiguous meaning. Also, what happens to this value if the
functions are old style and not new style?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20151017/9295f7d3/attachment.html>
More information about the es-discuss
mailing list