Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created August 6, 2013 09:40
Show Gist options
  • Save qoelet/6163167 to your computer and use it in GitHub Desktop.
Save qoelet/6163167 to your computer and use it in GitHub Desktop.
-- this works
expo :: Int -> Int -> Int
expo 0 n = 0
expo m 0 = 1
expo m n = m * (expo m (n - 1))
-- not this one
-- attempt to load in ghci throws: exponentiation.hs:11:10: Parse error in pattern: n + 1
expo :: Int -> Int -> Int
expo 0 n = 0
expo m 0 = 1
expo m (n+1) = m * (expo m n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment