Adding scanl'

Niklas Hambüchen mail at
Tue Sep 11 18:20:57 CEST 2012

I would like to propose adding a the functions scanl' and scanl1' to

The presence and regular use of foldl' and foldl1' suggests that
corresponding scan functions should be available.

> scanl'                   :: (a -> b -> a) -> a -> [b] -> [a]
> scanl' f q ls            =  q `seq` (q : (case ls of
>                                      []   -> []
>                                      x:xs -> scanl' f (f q x) xs))

What do you think?


More information about the Libraries mailing list