Skip to content

Instantly share code, notes, and snippets.

@datashaman
Last active May 8, 2019 05:06
Show Gist options
  • Select an option

  • Save datashaman/0fc03b73bc222322e0ce43cda6fa2c09 to your computer and use it in GitHub Desktop.

Select an option

Save datashaman/0fc03b73bc222322e0ce43cda6fa2c09 to your computer and use it in GitHub Desktop.
Datashaman\Logic\curry Example
<?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