Le 13/05/2016 à 20:16, Sara Golemon a écrit :
Just to verify, you're suggesting an end-state something like this?

$ret = array(1,2,3)
  |> array_map(function($x) { return $x * 2; }) // lhs implicitly
passed as second arg
  |> array_sum(); // implicitly passed as only arg (first position)
// $ret === int(12)

Right. And also :

array(1,2,3)
   |> array_map(function($x) { return $x * 2; })
   |> $intermediate_var
   |> array_sum()
   |> $ret;

Talking about arrays, I am also thinking of a '[]>' operator (name may vary). This would take an array as input, and output another array, where every value would have been run through the function. The keys would be preserved. Example :

array('a','b','key' => 'c') []> ord(); // produces [ 97, 98, 'key' => 99 ]

Regards

François


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to