Re: Arrow function expressions in PHP

From: Date: Thu, 01 Oct 2015 16:47:10 +0000
Subject: Re: Arrow function expressions in PHP
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-88611@lists.php.net to get a copy of this message
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]

« previous php.internals (#88611) next »