Levi Morrison wrote on 01/10/2015 16:52:
This is close:https://github.com/morrisonlevi/Algorithm/blob/master/src/reduce.php
When would you store or pass around the intermediate callback (the result of reduce($initial)) without immediately invoking it with a callback? If you just run "reduce($initial)($my_fn)($data)", it seems no more useful than "reduce(42, $my_fn, $data)", which would be more efficient internally.
If anything, I can imagine wanting to write $my_reduce = reduce($my_fn) and then $my_reduce($initial, $data), but that's still 2 steps rather than 3.
Genuine question, not a criticism - this functional(?) style of composition is not something I'm very familiar with. (For the same reason, I struggle to read that function definition no matter which syntax it's expressed in.)
Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php