Eric Elliott

Nice overview, but could use better distinction between partial application and currying.

Put simply, a partial application (partially applied function) is a function which has already been applied to some - but not yet all - of its arguments.

A curried function is a function which takes multiple arguments one at a time by returning a series of functions which each take the next argument until the application is complete.

All curried functions produce partial applications, but in JavaScript, not all partial applications are the result of curried functions. (Of course, they are in languages like Haskell which feature automatic currying of all functions).

The one at a time requirement is important in curried functions because the unary nature of a partially applied curry is what makes it composable.

Because a function can only return a single value (even if that value is an array or stream), functions composed in a pipeline must be unary — they must expect a single argument.

Composition is foundational in functional programming. I wrote about this relationship in detail in my book, “Composing Software”. The chapter called something like “Curry and Function Composition”. If you Google it, you can probably also find a corresponding blog post. There’s also a video walkthrough for members of

Eric Elliott

Written by

Make some magic. #JavaScript

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade