[Haskell-beginners] factorial question
kmandpjlynch at verizon.net
Fri Aug 31 18:23:24 CEST 2012
I'm going thru Graham Hutton's book "Programming in Haskell" [and am viewing the associated online lectures by Erik Meijer and Graham].
I find both to be excellent.
My problem is with the following statements:
factorial' :: Int -> Int
factorial' 0 = 1
factorial' (n+1) = (n+1)*factorial' n
When I load this into GHC I get the following error:
pihch01.hs:128:13: Parse error in pattern: n + 1
I'd appreciate any advice.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners