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 I prefer the one that doesn't disappear while I'm trying to read it. 😛

Follow

re: programming style poll 

@aschmitz formatting is hard, ok

re: programming style poll 

@wallhackio You got there in the end!

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.