Comment

Comment by splintercell

With all due respect, I don't think you understand the purpose of currying and partial application. In your defense, the article merely explains what currying is, but does not explain why you need it.

For instance while writing functional Javascript code, I never curry my methods, instead I use helper methods from functional libraries such as lodash or Ramda to curry.

Where currying is useful is in cases like this:

  ```javascript
  //Definitions
  const filterUsers = (fieldName, value, users) => //Implementation
  const sortUsersBy = (fieldName, users) => //Implementation
  const takeUsers = (count, users) => //Implementation

  //Without currying
  UserService
   .getUsers()
   .then(users => filterUsers('active', true, users))
   .then(users => sortUsersBy('age', users))
   .then(users => takeUsers(3, users));

  //If these methods were curried
  UserService
   .getUsers()
   .then(filterUsers('active', true))
   .then(sortUsersBy('age'))
   .then(takeUsers(3));
  ```
Here is a video which explains proper uses of currying (and does it very well) [1]. Here is another article if your coworker start using functional programming and you want to stop them [2].

1. https://www.youtube.com/watch?v=m3svKOdZijA

2. https://brianmckenna.org/blog/howtostopfp

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton