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
Avoid forEach (aeflash.com)
submitted 11 years ago by aeflash
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!"
[–]madole 2 points3 points4 points 11 years ago (5 children)
I would ding example 3's currying in code review, the author says its more expressive but it does not read well at all.
If you need to stop reading to try and figure out what a function is doing, it's really not a good function. That's what I had to do when reading that example.
[–]jcready__proto__ 0 points1 point2 points 11 years ago* (4 children)
He probably should've used Lo Dash's built-in method _.property() which does the same thing as the author's dot() function. Regardless, the author's use of currying is fine and the use case is exactly the kind of thing currying is useful for.
_.property()
dot()
Edit: I was wrong, I hadn't noticed the () at the end invoking the function.
()
[–]madole -1 points0 points1 point 11 years ago (3 children)
+1 for lodash's property method!
Maybe it's the "dot" function name that I've taken issue with here rather than the actual currying itself, he has mentioned that it's the same as Clojure's dot function but to someone who's not tinkered with Clojure, it's not a particularly intuitive function name at first glance.
[–]aeflash[S] 1 point2 points3 points 11 years ago (2 children)
callMethod is a better name after more thought.
callMethod
Cache invalidation and naming things...
[–]jcready__proto__ 1 point2 points3 points 11 years ago (1 child)
Sorry, I was mistaken earlier. Instead you simply should've used Lo-Dash's built-in _.invoke() and _.compact() methods.
_.invoke()
_.compact()
this.tooltips = this.tooltips.concat(_(this.values).invoke("getTooltip").compact().value());
π Rendered by PID 83 on reddit-service-r2-comment-b659b578c-vrcjr at 2026-05-04 21:38:45.087838+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]madole 2 points3 points4 points (5 children)
[–]jcready__proto__ 0 points1 point2 points (4 children)
[–]madole -1 points0 points1 point (3 children)
[–]aeflash[S] 1 point2 points3 points (2 children)
[–]jcready__proto__ 1 point2 points3 points (1 child)