Last active
April 17, 2018 14:56
-
-
Save poohitan/aafc9674eebdaaafe772383807e27762 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const number = (num) => operation => operation ? operation(num) : num; | |
const zero = number(0); | |
const one = number(1); | |
const two = number(2); | |
const three = number(3); | |
const four = number(4); | |
const five = number(5); | |
const six = number(6); | |
const seven = number(7); | |
const eight = number(8); | |
const nine = number(9); | |
const plus = (right) => left => left + right; | |
const minus = (right) => left => left - right; | |
const times = (right) => left => left * right; | |
const dividedBy = (right) => left => left / right; | |
console.log( | |
seven(times(five())), | |
one(plus(nine())), | |
eight(minus(six())), | |
nine(dividedBy(three())) | |
); // 35, 10, 2, 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment