Hey Underscore, You're Doing It Wrong!
Why Hacker News recommends it
A repeatedly recommended introduction to functional JavaScript that explains currying and why data should come last.
What it is
Brian Lonsdorf explains why Underscore.js falls short as a functional programming library, then introduces currying, composition and point-free style in JavaScript. He argues for data-last argument ordering.
Recommended by 9 HN commenters across 7 different months, 2014 to 2022.
What Hacker News said
Strong rec lrichardson · 2014-04 · on “Functional JavaScript, Part 3: apply, call, and the arguments object”
That is great feedback. I am actually working on creating a "functional" version of the 2048 game, along with my own implementation of the AI solver, as part of this series. Kinda goofy, and maybe not a "real world" situation as much, but should at least show the concepts being applied. I also very much recommend this video by Brian Lonsdorf, titled "Hey Underscore, You're Doing It Wrong!: [this video]
Strong rec wizao · 2015-01 · on “Lodash v3.0.0”
There is an excellent talk called "Underscore, you're doing it wrong!". The talk explains how well designed param order with currying leads to very short and expressive code -- and how underscore missed the boat. This aspect of it should be interesting as it's related to this post. It's well worth the watch. [this video]
Strong rec r3a1d33p · 2022-08 · on “Ask HN: Learning Functional Programming in 2022?”
I find this talk inspiring. Underscore.js got many things wrong for FP: [this video] . I've read Grokking Simplicity too. It's very approachable book. Highly recommend it for JS/TS developers who want to learn FP!
Recommends grayrest · 2014-07 · on “Don’t Be Scared Of Functional Programming”
If you're interested in FP in javascript, you should check out the relatively new Ramda.js [1]. It switches from the underscore style collection first call pattern to a collection last pattern and automatically curries its functions. The combination allows for easier function composition. [1] [LINK] More info on the topic: [LINK] [this video] [LINK]
Recommends hueyp · 2014-07 · on “Videos about JavaScript”
I would add: 'Hey Underscore, You're Doing It Wrong' -- [this video] It is much better than the title would suggest :)
Recommends lsdafjklsd · 2014-07 · on “A Gentle Introduction to Monad Transformers – or, Values as Exceptions”
Meh, I don't know or use Haskell and I'm interested in this stuff. I'm a javascript programmer introduced to these concepts via [1] [this video] and [LINK] . Programming in a point free style in javascript is great! 1: Hey Underscore, You're Doing it Wrong!
Recommends ignoramous · 2015-07 · on “Mostly Adequate Guide to Functional Programming in JavaScript”
You might already be using certain functional programming constructs without being aware of them. Contrary to popular misconception, OOP and functional programming don't have to be mutually exclusive. "Pure" functional programming (ala Haskell) and OOP most certainly are to an extent non-overlapping (since OOP has state+behaviour at its core), and pure fn-languages have no side-effects. High-order function in java don't exist, so one would do : new Thread(new Runnable() { ... }).start(); A builder pattern can be distilled down as a form of partial application (or, currying, if you like. They aren't the same thing, but are very similar): alertDialog .setMessage(...) .setPositiveButtonText(...
Recommends patricklynch · 2016-07 · on “Just: A library of dependency-free JS utilities that do just do one thing”
Because then you can curry/partially apply functions independent of your data. It's _not_ because it's convention everywhere else. (I realize that only really makes sense if you know why it makes sense, so this video gives a pretty good explanation in ~30 minutes - [this video] )