Skip to content

Instantly share code, notes, and snippets.

@arvinsim
Last active August 29, 2015 14:16
Show Gist options
  • Save arvinsim/dfc468c73afbcdb46898 to your computer and use it in GitHub Desktop.
Save arvinsim/dfc468c73afbcdb46898 to your computer and use it in GitHub Desktop.
A simple factorial function in Haskell
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