hsghci> foldl (+) 0 [1,2,3,4] 10 ghci> scanl (+) 0 [1,2,3,4] [0,1,3,6,10]
hsfacs = scanl (*) 1 [1..] -- [1,1,2,6,24,120,..] fact n = facs !! n