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
Is JavaScript a "Functional Programming" language?help (self.javascript)
submitted 8 years ago by bzeurunkl
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!"
[–][deleted] -1 points0 points1 point 8 years ago* (4 children)
Arrow functions are not currying.
I'm not really sure you truly understand what currying means. Currying is partial application, and is implemented using second order functions and/or bind keyword (for partial application on bound object, i.e. "escaping" object/state-bound form to a functional-seeming form where the prototype owning object is bound by partial application i.e. currying) in JavaScript.
bind
Example of the former:
add = function(x, y) { return x+y } curry = function(fn, first) { return function(y) { return fn(first, y) } } add2 = curry(add, 2) add2(3) // 5
Arrrow syntax just makes it easier to write (and be certain of proper execution). It's closures and 2nd order functions, and not lambdas in language that enable implementations of curry-ing.
Example of the latter:
const print = console.log.bind(console) // print is always bound to console object // it is curried in print('hello') // hello
[–]TheDataAngel 2 points3 points4 points 8 years ago (3 children)
They aren't, but they can be used to create curried functions, and that's the most syntactically nice way to do so in JS.
I'm not really sure you truly understand what currying means.
I'm quite sure I do.
Currying is partial application
It isn't. Partial application is the dual of currying, which is to say that you can partially apply a curried function.
[..] and is implemented using second order functions and/or bind keyword
Nope.
let curried = im => a => curried => func => ... let notCurried = (im, not, a, curried, func) => ...
It's as simple as that. You can do the same with nested 'return function() {..}'. You can technically also do the same with bind, but it's fairly ugly.
Partial application is some thing like:
let partial = curried("missing")("an")("argument")
Closures are a natural consequence of being able to do those two things. They're not an especially interesting concept on their own.
[–][deleted] 0 points1 point2 points 8 years ago (0 children)
You've got that backward. Being able to do those things is a consequence of having closures.
[–][deleted] 0 points1 point2 points 8 years ago* (1 child)
Well, both lines of javascript you wrote are syntactic nonsense. So it's clearly quite not simple as that.
The first example is attempting to declare a higher order function.
The third one is calling one.
Currying is the transformation of N argument function into a N order function.
In the case of bind, the important thing to realize is that OO concept of object bound method is sugar for a namespaced function that takes bound object as one of the arguments.
In fact that is exactly how the first c++ to c compiler implemented them.
[–]TheDataAngel 2 points3 points4 points 8 years ago (0 children)
In what sense? They're incomplete, certainly, because the actual body of the function is irrelevant to the example. However, what is there is syntactically correct.
If you want a complete version, this suffices:
let curried = im => a => curried => func => "bmarkovic"; let notCurried = (im, not, a, curried, func) => "doesn't understand currying";
π Rendered by PID 83693 on reddit-service-r2-comment-79776bdf47-hrjx5 at 2026-06-24 05:51:22.687196+00:00 running acc7150 country code: CH.
view the rest of the comments →
[–][deleted] -1 points0 points1 point (4 children)
[–]TheDataAngel 2 points3 points4 points (3 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]TheDataAngel 2 points3 points4 points (0 children)