3 ms·
Thrush combinator is neat. Here's another without using recursion: const thrush2 = (value, ...funcs) => funcs.reduce((value, func) => func(value), value);
by runald 4y ago
Thrush combinator is neat. Here's another without using recursion:
const thrush2 = (value, ...funcs) => funcs.reduce((value, func) => func(value), value);
const thrush3 = (value, ...funcs) => { for (const func of funcs) value = func(value); return value }
- MathMonkeyMan 4y agoReduce is perfect for this, nice point.