Skip to content

Instantly share code, notes, and snippets.

@raganwald
Created December 11, 2012 12:44
Show Gist options
  • Save raganwald/4258303 to your computer and use it in GitHub Desktop.
Save raganwald/4258303 to your computer and use it in GitHub Desktop.
The compose function is called B or "The Bluebird" in Combinatory Logic
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