Created
June 8, 2011 12:59
-
-
Save wridgers/1014370 to your computer and use it in GitHub Desktop.
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
fact :: (Integral a) => a -> a | |
fact f | |
| f == 0 = 1 | |
| otherwise = f*fact (f-1) | |
fac :: (Integral a) => a -> a | |
fac 0 = 1 | |
fac n = n*fac(n-1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I thought that you were trying to create a tailrecursive variant. Like this: