public function testCurried()
{
$curriedStrReplace = curried('str_replace');
$replaceUnderscores = $curriedStrReplace('_');
$replaceUnderscoresWithSpaces = $replaceUnderscores(' ');
$this->assertEquals('Hello world!', $replaceUnderscoresWithSpaces('Hello_world!'));
$f = function ($a, $b, $c = 'c') {
return join('', func_get_args());
};
$curriedF = curried($f);
$f1 = $curriedF('a');
$this->assertEquals('ab', $f1('b'));
$curriedFWithOptinalArgs = curried($f, true);
$f1 = $curriedFWithOptinalArgs('a');
$f2 = $f1('b');
$this->assertEquals('abc', $f2('c'));
$curriedFWithFourArgs = curried($f, 4);
$f1 = $curriedFWithFourArgs('a');
$f2 = $f1('b');
$f3 = $f2('c');
$this->assertEquals('abcd', $f3('d'));
}