Skip to content

Instantly share code, notes, and snippets.

@nickciolpan
Created May 25, 2021 05:32
Show Gist options
  • Save nickciolpan/3133c517004c6faa5ba82bceb0aea60c to your computer and use it in GitHub Desktop.
Save nickciolpan/3133c517004c6faa5ba82bceb0aea60c to your computer and use it in GitHub Desktop.
// www.codewars.com/kata/525f3eda17c7cd9f9e000b39
const curry = (operand, operator) => (!operator) ? operand : operator(operand);
const [zero, one, two, three, four, five, six, seven, eight, nine] =
[0,1,2,3,4,5,6,7,8,9].map(operand => ((operator) => curry(operand, operator)));
const plus = (first) => (second) => second + first;
const minus = (first) => (second) => second - first;
const times = (first) => (second) => second * first;
const dividedBy = (first) => (second) => Math.floor(second / first);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment