Original article published at : https://namc.in/2018-02-22-currying
Inspiration
This post is written after I saw a tweet which read
...
For further actions, you may consider blocking this person and/or reporting abuse
I'm unclear on the Lisp snippet you give in the paragraph starting "If you are familiar with other languages..." It looks based on context ("Java's
f(a, b, c)
") like you're trying to show calling the functionf
with the argumentsa
,b
andc
, which would traditionally look likeYour existing Lisp snippet,
(((f a) b) c)
is how one would call a curried function of 3 arguments in Lisp, which translates to Java asf(a)(b)(c)
(I think. Does Java even do anonymous functions? That's how it would look in C++, Javascript, etc., at least).Great article.
On the function:
curry f n = \m -> f n m
g = curry (+) 5
h = curry (*) 5
The last line should be:
Can someone make a Javascript version of this? I've been trying to find a convincing example and explanation of currying for a while now.
what a way to program !!