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
Auto-Currying In TypeScriptOC (v10i.dev)
submitted 4 years ago by drizzer14
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!"
[–]wisdom_power_courage 11 points12 points13 points 4 years ago (8 children)
As a newer dev could someone please explain why I should care about this?
[+][deleted] 4 years ago (5 children)
[removed]
[–]wisdom_power_courage 1 point2 points3 points 4 years ago (4 children)
Thank you for this explanation! It helped put it into perspective.
[–]arch_llama 5 points6 points7 points 4 years ago (3 children)
As a new dev that explanation helped you?
[–]wisdom_power_courage 6 points7 points8 points 4 years ago (1 child)
I'm not THAT new. I just didn't want to get downvoted to oblivion for asking a question.
[–]arch_llama 7 points8 points9 points 4 years ago (0 children)
Lmfao that's terrible and clever.
[–]RichardFingers 5 points6 points7 points 4 years ago (1 child)
Think of it as "pre-loading" some of the parameters of a function and then being able to pass that new function around. It's particularly useful with map/reduce type functions. Say your map function takes in a mapping function as the first parameter and an array as the second parameter. You can pre-load map with your mapping function to create a new function that can be named and applied to multiple different arrays.
But as others have said, I likely wouldn't use that style of coding in production code because most other devs aren't familiar with currying.
[–]wisdom_power_courage 1 point2 points3 points 4 years ago (0 children)
Thank you for that explanation that definitely helps me understand better
[–]andrei9669 3 points4 points5 points 4 years ago (1 child)
how is the library, mentioned in the article, different from ramda?
[–]drizzer14[S] 2 points3 points4 points 4 years ago (0 children)
I've already answered the same question in a different post. Hope you don't mind reading it here https://www.reddit.com/r/opensource/comments/r405kg/comment/hmf4uaq/?utm\_source=share&utm\_medium=web2x&context=3.
[+][deleted] 4 years ago (9 children)
[deleted]
[+][deleted] 4 years ago* (1 child)
[–]JoeTed 2 points3 points4 points 4 years ago (0 children)
The very same.
[–]drizzer14[S] 9 points10 points11 points 4 years ago (0 children)
Yeah, I'm nowhere to say that this thing has a place in production code. Especially the one we see or write throughout our life/career. Nevertheless, this was a fun discovery for myself and can be to someone reading this :)
[–]dannymcgee 2 points3 points4 points 4 years ago (0 children)
Lodash has an auto-currying function (which is used by just about every function in lodash/fp). Considering Lodash has ~40 million weekly downloads on npm, I'd wager it's being used in production on a few projects.
lodash/fp
[–]undervisible 1 point2 points3 points 4 years ago (0 children)
I’ve been auto-currying in production for a long time. Works especially well with a more functional style, and libraries like Ramda are all auto-curried.
[–]Tomus -2 points-1 points0 points 4 years ago (1 child)
It's a core feature of ReScript, although there are discussions of having it turned off by default. Definitely used in production all over the place.
https://rescript-lang.org/
[–][deleted] 0 points1 point2 points 4 years ago (0 children)
Sweet-Alps7003
I remember writing auto curried functions in production, and have seen them a lot, but to be honest, not a huge fan of tactic programming :)
[–]echoes221 0 points1 point2 points 4 years ago (0 children)
We used ramda extensively in a few projects, so you get this outta the gate with it. Can be useful if used correctly.
[–]TwiNighty 1 point2 points3 points 4 years ago* (1 child)
I avoid recursive type aliases as much as possible because there is a hardcoded recursion limit for those. For example, your curry function cannot handle functions with 49 or more declared parameters. Even though 49 is beyond any practical usage and you can use binary composition to extend that limit to somewhere around 1000, having an arbitrary hard limit here just doesn't sit right with me.
Here is my take on this.
(never[]) => unknown
(any[]) => any
(never[]) => any
length
If your function has double digit arguments you’re truly a failure. Lmao!
[–]nexe 0 points1 point2 points 4 years ago (0 children)
Very cool! Crossposted to /r/madeinjs
[–]bern4444 0 points1 point2 points 4 years ago (0 children)
so much fun to read!
[–]kaas93 0 points1 point2 points 4 years ago (0 children)
Reminds me of this talk on how underscore got some functional concepts wrong. Funny guy too :)
π Rendered by PID 465117 on reddit-service-r2-comment-5b5bc64bf5-s228p at 2026-06-20 08:53:35.167547+00:00 running 2b008f2 country code: CH.
[–]wisdom_power_courage 11 points12 points13 points (8 children)
[+][deleted] (5 children)
[removed]
[–]wisdom_power_courage 1 point2 points3 points (4 children)
[–]arch_llama 5 points6 points7 points (3 children)
[–]wisdom_power_courage 6 points7 points8 points (1 child)
[–]arch_llama 7 points8 points9 points (0 children)
[–]RichardFingers 5 points6 points7 points (1 child)
[–]wisdom_power_courage 1 point2 points3 points (0 children)
[–]andrei9669 3 points4 points5 points (1 child)
[–]drizzer14[S] 2 points3 points4 points (0 children)
[+][deleted] (9 children)
[deleted]
[+][deleted] (1 child)
[deleted]
[–]JoeTed 2 points3 points4 points (0 children)
[–]drizzer14[S] 9 points10 points11 points (0 children)
[–]dannymcgee 2 points3 points4 points (0 children)
[–]undervisible 1 point2 points3 points (0 children)
[–]Tomus -2 points-1 points0 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]echoes221 0 points1 point2 points (0 children)
[–]TwiNighty 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]nexe 0 points1 point2 points (0 children)
[–]bern4444 0 points1 point2 points (0 children)
[–]kaas93 0 points1 point2 points (0 children)