programming style poll
Suppose you have a function called pipe:
const addTwoAndSquare = pipe(
x => x + 2,
x => x * x);
console.log(addTwoAndSquare(1)); // 9
What is your preferred implementation?
const pipe = (...fns) =>
x => fns.reduce((z, fn) => fn(z), x);
VS
const pipe = (...fns) => {
return (x) => {
let z = x;
for (let i = 0; i < fns.length; ++i)
z = fn(z);
});
return z;
};
};
re: programming style poll
@wallhackio You got there in the end!
re: programming style poll
@wallhackio