Skip to content

Instantly share code, notes, and snippets.

@vlasovskikh
Created June 23, 2011 10:51
Show Gist options
  • Save vlasovskikh/1042342 to your computer and use it in GitHub Desktop.
Save vlasovskikh/1042342 to your computer and use it in GitHub Desktop.
Combinatory logic in CoffeeScript, JavaScript, and Python
I = (x) -> x
S = (f) -> (g) -> (x) -> (f x) (g x)
K = (x) -> (y) -> x
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;
};
};
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