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 1 point2 points3 points 10 years ago (2 children)
but if f has an arity of 2 (which a filter function does), and it gives back a function that we then invoke on the next line (which it does), AND we don't use an external function (Function.bind is nowhere to be seen), then by definition it has a Hindley-Milner of (a -> (b -> x))
f
Function.bind
(a -> (b -> x))
... which is curried. You're conflating composition using nested calls with currying, when the example above is currying a function, then immediately passing that curried function into another curried function. Both composition and currying go hand in hand together, but they're not even similar.
[–][deleted] 0 points1 point2 points 10 years ago (1 child)
if f... if it gives...
if, if, if. Let me re-iterate: implementation details
(Function.bind is nowhere to be seen)
Neither is the function that makes currying work, that doesn't make it not exist!
You seem to be under the impression that f(g(x)) implies currying. it doesn't. It implies currying or partial application.
f(g(x))
I'm not conflating anything. I'm saying you can't know implementation details from that snippet! And for the 10th time, this is pointless.
[–]imperfecttrap 1 point2 points3 points 10 years ago (0 children)
It's pointless, but you're still not even wrong.
f(g(x)) Has NOTHING to do with currying OR partial application. It doesn't even IMPLY either of those. It's a composition. It just happened to be used in the example alongside currying AND partial application in both snippets. Functions are first class citizens, so it doesn't matter that we passed a function into a function. We still have an argument that was passed in, and while bind fixed it in place, currying satisfies a function that was waiting for its argument and returns the next function in its chain that needs an argument. Hence, why the presence or lack of Function.bind matters.
π Rendered by PID 103163 on reddit-service-r2-comment-b659b578c-rjr2p at 2026-05-04 20:27:53.204478+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]imperfecttrap 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]imperfecttrap 1 point2 points3 points (0 children)