Created
August 2, 2014 03:54
-
-
Save svanellewee/a1e065937e5449aa7d3f to your computer and use it in GitHub Desktop.
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 cons(x, y) { | |
return function(w) { return w(x, y) }; | |
}; | |
function car(z) { | |
return z(function(x, y) { return x }); | |
}; | |
function cdr(z) { | |
return z(function(x, y) { return y }); | |
}; | |
var list = cons(1, cons(2, null)); | |
document.writeln( car(list)); | |
document.writeln( car(cdr(list))); | |
document.writeln( cdr(cdr(list))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment