Re: Arrow function expressions in PHP

From: Date: Thu, 01 Oct 2015 15:52:09 +0000
Subject: Re: Arrow function expressions in PHP
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-88608@lists.php.net to get a copy of this message
>> And one thing that makes auto capture much better choice than explicit >> capture (as it've been said a couple of times already) is partial >> application: >> >> $mul = fn($x) => fn($y) => fn($z) => $x * $y * $z; >> >> Looks simpler than: >> >> $mul = fn($x) => fn($y; $x) => fn($z; $x, $y) => $x * $y * $z; >> >> > Yes it looks simpler, but if this is going to continue being the argument > for auto-capturing can we at least get a real world example? I have never > once in the wild seen a lambda that returns a lambda that returns a lambda, > all using variables from the previous lamba(s). I'm fairly certain no one > will invoke the overhead of a function call 3 times just to multiply 3 > numbers together. Please give me a valid example if you want me to believe > this to be a valid argument. This is close: https://github.com/morrisonlevi/Algorithm/blob/master/src/reduce.php

« previous php.internals (#88608) next »