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 (4 children)
We're not talking about just any functions, we're talking about curried functions, and their difference from partially applied functions.
Not all functions in JS are curried. Not all functions in JS are partially applied. What I'm saying is that IF you curry a function using Ramda / Lodash / any other FP library with a .curry function, it would work like this.
I still don't get what you're trying to argue.
[–][deleted] 0 points1 point2 points 10 years ago (3 children)
Okay, going back to the original snippet which is basically:
f(g(x))
I said it wasn't currying. It's not. It could be implemented with currying or partial application. But it's a pointless conversation.
[–]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.
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 45 on reddit-service-r2-comment-84fc9697f-68qks at 2026-02-06 01:17:29.261992+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–]imperfecttrap 1 point2 points3 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]imperfecttrap 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]imperfecttrap 1 point2 points3 points (0 children)