DEV Community

Discussion on: Daily Coding Puzzles - Oct 29th - Nov 2nd

Collapse
 
simoroshka profile image
Anna Simoroshka
const make = (f, n) => f ? f(n) : n;
const one = f => make(f, 1);
const two = f => make(f, 2);
const three = f => make(f, 3);
const four = f => make(f, 4);
const five = f => make(f, 5);
const six = f => make(f, 6);
const seven = f => make(f, 7);
const eight = f => make(f, 8);
const nine = f => make(f, 9);
const ten = f => make(f, 10);

const plus = a => b => b + a;
const minus = a => b => b - a;
const times = a => b => b * a;
const dividedBy = a => b => b / a;
Enter fullscreen mode Exit fullscreen mode

thanks, it's fun :)