Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 461 Bytes

Curry.md

File metadata and controls

23 lines (14 loc) · 461 Bytes

Curry

Currying is a way to call a function with less parameters than it usually need

  const filterWith = filter => list => list.filter(filter);

  /* In a language with auto-currying the function would be written like:
    const filterWith = (filter, list) => {
      list.filter(filter);
    }

  */

  const filterWithMoreThan2 = filterWith(value => value > 2);

  filterWithMoreThan2([2,1,3,4]);
  // [3,4]