Created
November 29, 2011 19:15
-
-
Save lkuper/1406028 to your computer and use it in GitHub Desktop.
implementation of factorial for brid.js (https://github.com/jes5199/brid.js/)
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
> ["define", "*", ["lambda", ["n"], ["lambda", ["m"], ["if", ["eq?", "m", 0], 0, ["+", "n", [["*", "n"], ["-", "m", 1]]]]]]] | |
"some-lambda" | |
> ["define", "fact", ["lambda", ["n"], ["if", ["eq?", "n", 0], 1, [["*", "n"], ["fact", ["-", "n", 1]]]]]] | |
"some-lambda" | |
> ["fact", 5] | |
120 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment