Created
April 5, 2015 14:58
-
-
Save waywardmonkeys/56995b2738d6782e3dc9 to your computer and use it in GitHub Desktop.
Factorial in Dylan using singleton types
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
define method factorial (n == 0) 1 end; | |
define method factorial (n == 1) 1 end; | |
define method factorial (n) | |
n * factorial(n - 1) | |
end; | |
format-out("%d", factorial(10)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment