Hacker News new | past | comments | ask | show | jobs | submit login

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 }



Reduce is perfect for this, nice point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: