Last active
August 29, 2015 14:16
-
-
Save arvinsim/dfc468c73afbcdb46898 to your computer and use it in GitHub Desktop.
A simple factorial function in Haskell
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
factorial :: Integer -> Integer | |
factorial i | |
| i <= 0 = 1 | |
| otherwise = i * factorial(i-1) | |
main = do | |
-- 120 | |
print (factorial 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment