Hacker News new | ask | show | jobs
by zowanet 1570 days ago
Passing the first argument as part of the variadic array isn't necessary.

Here's my version in only 66 bytes, what do I win? ;)

  <?php function pipe($v,...$p){foreach($p as$f)$v=$f($v);return$v;}
2 comments

64! (if you don't mind calling a variable).

    <?php $pipe=fn($v,...$p)=>array_reduce($p,fn($a,$f)=>$f($a),$v);
I guess I was just removing the need for an unnecessary class, but that's fair.