Created
May 12, 2014 20:18
-
-
Save achisholm/57656d45628a89b4e21c to your computer and use it in GitHub Desktop.
Problem 5
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
// Write a function that takes a binary function, and makes it callable with two invocations. | |
function mul(x, y){ | |
return x * y; | |
} | |
function applyf(binary){ | |
return function (x) { | |
return function (y) { | |
return binary(x, y); | |
}; | |
}; | |
} | |
console.log(applyf (mul) (3) (4)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment