Created
May 31, 2011 13:28
-
-
Save tfnico/1000498 to your computer and use it in GitHub Desktop.
Weel examples
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
// Note the tail call optimization! | |
private func fact_f(n, result) | |
return n > 0 ? fact_f(n - 1, result * n) : result; | |
end | |
func fact(n) | |
return fact_f(n, 1); | |
end | |
// fact(140): 8.791460022621322E - 4 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For more goodness, see https://github.com/rjeschke/weel