Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

facts

Name: Anonymous 2009-04-21 8:46

ITT: Your favourite implementation of fact.

Mine would be:
fact x = foldr (*) 1 $ takeWhile (/= 1) [x,x-1..]
I wrote it today :3

Name: Anonymous 2009-04-22 3:50

Prelude> let fac 1=1
Prelude> let fac n = n * fac(n-1)
Prelude> fac 10
*** Exception: stack overflow

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List