Skip to content

Instantly share code, notes, and snippets.

@chomado
Last active August 29, 2015 14:12
Show Gist options
  • Select an option

  • Save chomado/78fe3854e9317f2757fb to your computer and use it in GitHub Desktop.

Select an option

Save chomado/78fe3854e9317f2757fb to your computer and use it in GitHub Desktop.
-- fact 5
-- → 5 * 4 * 3 * 2 * 1
fact :: Int -> Int
fact 0 = 1
fact x = x * fact (x - 1)
main :: IO()
main = do
print $ fact 5 -- 120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment