> fac n = foldl' (*) 1 [1..n] -- Prelude.foldl' uses O(1) stack

or, more succinctly,
 
factorial n = product [1 .. n]

which also appears in the examples distributed with Hugs, I think.


-- 
J�n Fairbairn                                 [EMAIL PROTECTED]
18 Kimberley Road                                        [EMAIL PROTECTED]
Cambridge CB4 1HH                      +44 1223 570179 (pm only, please)


Reply via email to