Skip to content

Instantly share code, notes, and snippets.

@abiodun0
Created January 19, 2019 05:06
Show Gist options
  • Save abiodun0/6d6abd6baba0263e3cb92d2f9283790c to your computer and use it in GitHub Desktop.
Save abiodun0/6d6abd6baba0263e3cb92d2f9283790c to your computer and use it in GitHub Desktop.
some neat tricks
const uncurry = fn => (...args) => args.reduce((acc, arg) => acc(arg), fn)
const add = x => y => x + y
const sum = xs => xs.reduce((x, y) => uncurry(add)(x, y))
sum([1, 2, 3])
// -> 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment