rfc:operator_functions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:operator_functions [2017/09/09 00:17] – clarify ajfrfc:operator_functions [2017/09/09 21:32] – include partial apply sample ajf
Line 62: Line 62:
 <code php> <code php>
 // Select only the positive numbers // Select only the positive numbers
-$positiveSubset = array_filters($numbers, partialApply('>', 0));+$positiveSubset = array_filter($numbers, partialApply('<', 0));
 </code> </code>
 +
 +An example working partial application implementation would be:
 +
 +<file php partialApply.php>
 +function partialApply(callable $c, ...$args) {
 +    return function (...$args2) use ($c, $args) {
 +        return $c(...$args, ...$args2);
 +    };
 +}
 +</file>
  
 ==== Detail ==== ==== Detail ====
Line 153: Line 163:
 The existing operators themselves behave the same as ever. The existing operators themselves behave the same as ever.
  
-Quoting function names in function calls is not new, it is a consequence of [[rfc:uniform_variable_syntax|Uniform Variable Syntax]].+Being able to quote function names in function calls (e.g. <php>'+'(1, 1)</php>is not new idea introduced by this RFC, it has been possible since [[rfc:uniform_variable_syntax|Uniform Variable Syntax]] in PHP 7.0.
  
 ===== Future Scope ===== ===== Future Scope =====
rfc/operator_functions.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1