Last active
May 8, 2019 05:06
-
-
Save datashaman/0fc03b73bc222322e0ce43cda6fa2c09 to your computer and use it in GitHub Desktop.
Datashaman\Logic\curry Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| <<<CONFIG | |
| packages: | |
| - "datashaman/logic: dev-master" | |
| CONFIG; | |
| # | |
| # This is a Melody script. http://melody.sensiolabs.org/ | |
| # | |
| use function Datashaman\Logic\curry; | |
| $times = function ($x, $y) { | |
| return $x * $y; | |
| }; | |
| $double = curry($times, 2); | |
| $triple = curry($times, 3); | |
| echo $double(4) . PHP_EOL; | |
| echo $triple(4) . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment