Skip to content

Instantly share code, notes, and snippets.

@Nil-Zil Nil-Zil/factorial.hs
Created Jan 20, 2018

Embed
What would you like to do?
Iterating and recursing implementation of factorial.
factRecur :: Int -> Int
factRecur 0 = 1
factRecur n = n * factRecur (n - 1)
factIter :: Int -> Int -> Int
factIter 0 m = m
factIter n m = factIter (n - 1) n * m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.