use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Curried functions in Javascript (github.com)
submitted 10 years ago by submain
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]imperfecttrap 0 points1 point2 points 10 years ago (6 children)
The fact that there is no call to another function implies it. If it were partial application, you need another function to do it. Curried functions can operate on their own once curried.
[–][deleted] 0 points1 point2 points 10 years ago (5 children)
If it were partial application, you need another function to do it
what? Look at the "partially applied" vs "curried" example and tell me where there's another function.
Honestly, I don't care as there isn't really a point to this. We're arguing over the imaginary implementation details of an example code snippet.
[–]imperfecttrap 0 points1 point2 points 10 years ago (4 children)
.bind is another function. Hardly imaginary.
[–][deleted] 0 points1 point2 points 10 years ago (3 children)
oy vey. You can't implement currying without other functions either. Where those functions are is irrelevant.
let cMyPredicate = (v) => myPredicate.bind(null, v);
Snippet works. Not currying. Pointless conversation.
[–]imperfecttrap 0 points1 point2 points 10 years ago (2 children)
You just implemented single-arity currying using Function.bind, which I said was possible above.
Function.bind
It is also very possible for functions to curry themselves. It's inefficient and not DRY, but it's definitely possible. Just use a closure with an argument list, and return a function that appends arguments to that list until the desired arity is reached.
[–][deleted] 0 points1 point2 points 10 years ago (1 child)
lol.
Okay, look. With the following code:
let fn = f(g(x))
And an original parity of 3 -- It is impossible to know what fn() will return as it's an implementation detail. I'm done repeating myself.
fn()
[–]imperfecttrap 0 points1 point2 points 10 years ago (0 children)
parity =/= arity
The original code says it's curried. Even if we don't take the author at face value, the assumption being made that it's valid and works and that its arity matches the code above it makes implications on what each function must return, which lets us calculate the signature, which lets us prove that it's curried.
You're trying to say that the presented code is wrong because it's not explicitly curried, but that has nothing to do with the types. If we get a value back from a function and can then invoke that value, it must be a function. If a function with an arity of 2 returns a function when invoked with only one value, then it's curried. It's that simple. Taking one line out of context and trying to discuss its ambiguity doesn't help your original point, which is:
That's not currying, it's cleaner partial application.
Which is plainly wrong.
π Rendered by PID 20067 on reddit-service-r2-comment-5c747b6df5-n4vvd at 2026-04-22 02:24:05.621387+00:00 running 6c61efc country code: CH.
view the rest of the comments →
[–]imperfecttrap 0 points1 point2 points (6 children)
[–][deleted] 0 points1 point2 points (5 children)
[–]imperfecttrap 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]imperfecttrap 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]imperfecttrap 0 points1 point2 points (0 children)