Skip to content

Instantly share code, notes, and snippets.

@e-mihaylin
Created August 30, 2018 08:47
Show Gist options
  • Select an option

  • Save e-mihaylin/5285503fdb216ffe607ebbd8078cc9fc to your computer and use it in GitHub Desktop.

Select an option

Save e-mihaylin/5285503fdb216ffe607ebbd8078cc9fc to your computer and use it in GitHub Desktop.
const makeNumber = (n, f) => f ? f(n) : n;
const zero = f => makeNumber(0, f);
const one = f => makeNumber(1, f);
const two = f => makeNumber(2, f);
const three = f => makeNumber(3, f);
const four = f => makeNumber(4, f);
const five = f => makeNumber(5, f);
const six = f => makeNumber(6, f);
const seven = f => makeNumber(7, f);
const eight = f => makeNumber(8, f);
const nine = f => makeNumber(9, f);
const plus = b => a => a + b;
const minus = b => a => a - b;
const times = b => a => a * b;
const dividedBy = b => a => a / b;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment