Created
June 23, 2011 10:51
-
-
Save vlasovskikh/1042342 to your computer and use it in GitHub Desktop.
Combinatory logic in CoffeeScript, JavaScript, and Python
This file contains hidden or 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
I = (x) -> x | |
S = (f) -> (g) -> (x) -> (f x) (g x) | |
K = (x) -> (y) -> x |
This file contains hidden or 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 I(x) { | |
return x; | |
}; | |
function S(f) { | |
return function(g) { | |
return function(x) { | |
return (f(x))(g(x)); | |
}; | |
}; | |
}; | |
function K(x) { | |
return function(y) { | |
return x; | |
}; | |
}; |
This file contains hidden or 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
I = lambda x: x | |
S = lambda f: lambda g: lambda x: (f(x))(g(x)) | |
K = lambda x: lambda y: x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment