Created
December 11, 2012 12:44
-
-
Save raganwald/4258303 to your computer and use it in GitHub Desktop.
The compose function is called B or "The Bluebird" in Combinatory Logic
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
function bluebird (a) { | |
return function (b) { | |
return function (c) { | |
return a(b(c)) | |
} | |
} | |
} | |
function hard (str) { return "hard " + str } | |
function rock (str) { return "rock " + str } | |
hard(rock('city')) | |
//=> "hard rock city" | |
var hardrock = bluebird(hard)(rock); | |
hardrock('city') | |
//=> "hard rock city" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment