Created
June 16, 2016 08:59
-
-
Save Mizzlr/60abd971ff22720c4cc1566219f3a787 to your computer and use it in GitHub Desktop.
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 numerify(churchNumeral) { | |
return churchNumeral(function (x) { | |
return x + 1; | |
})(0); // f is a function that increments the value by 1; z=0 | |
} | |
// example | |
numerify(ZERO) // returns 0 | |
var ONE = SUCC(ZERO) | |
numerify(ONE) // returns 1 | |
var FOUR = SUCC(SUCC(SUCC(SUCC(ZERO)))) | |
numerify(FOUR) // returns 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment