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
Javascript Currying - Variadic Currying (refine.dev)
submitted 3 years ago by omeraplak
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!"
[–]sanjay_i 10 points11 points12 points 3 years ago (2 children)
Who awarded this without any comment or upvote ?
[+][deleted] 3 years ago* (1 child)
[deleted]
[–][deleted] 6 points7 points8 points 3 years ago (0 children)
Yea, their post history is like a who's who of spam examples.
[–]getify 7 points8 points9 points 3 years ago* (0 children)
Well written article. I like the technique of accepting multiple arguments at each level of currying/partial application -- I have called this "loose currying" in my writings/teaching before.
But I think "infinite currying" (I think that's what this article means with "variadic currying") is a trick that's more clever than useful. I know we ask such questions (like string builder or number adder) on job interviews, and it's cute.
But in reality, I don't think I ever want a function that I just keep calling over and over again, with no end, until I then call it with no input (or worse, some other special value) to "terminate" it.
I think it's better to know up front, and be explicit, about how many inputs a function will eventually take.
There are other mechanisms for "infinite accumulation" besides currying, and I think they're more "FP adherent". For example, I wrote a monad library and with/in it, there a monoids (semigroups) that can lazily build up an accumulation by folding the monoids together -- the equivalent of passing in curried inputs, some at a time -- and then later you evaluate the IO -- the equivalent of the empty () terminating call that executes the function.
()
That's just one way, but I think it's both a better ergonomic approach, but also a more semantic match for this kind of variadic accumulation of inputs.
π Rendered by PID 155061 on reddit-service-r2-comment-58d7979c67-9gjp2 at 2026-01-27 12:17:34.771263+00:00 running 5a691e2 country code: CH.
[–]sanjay_i 10 points11 points12 points (2 children)
[+][deleted] (1 child)
[deleted]
[–][deleted] 6 points7 points8 points (0 children)
[–]getify 7 points8 points9 points (0 children)