Created
January 12, 2017 03:34
-
-
Save thomasRag/570daec9b153c0c0307e9310b1dd71a9 to your computer and use it in GitHub Desktop.
php adaptation of : https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch5.html
This file contains 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 | |
$compose = function($f, $g){ | |
return function($x) use ($f,$g) { | |
return $f($g($x)); | |
}; | |
}; | |
$toUpperCase = function($x) { | |
return strtoupper($x); | |
}; | |
$exclaim = function($x) { | |
return $x . '!'; | |
}; | |
$shout = $compose($exclaim, $toUpperCase); | |
echo $shout("send in the clowns"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment