Skip to content

Instantly share code, notes, and snippets.

@lkuper
Created November 29, 2011 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lkuper/1406028 to your computer and use it in GitHub Desktop.
Save lkuper/1406028 to your computer and use it in GitHub Desktop.
implementation of factorial for brid.js (https://github.com/jes5199/brid.js/)
> ["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