@@ -364,6 +364,32 @@ Foldable List where
364toList : Foldable t => t a -> List a
364toList : Foldable t => t a -> List a
365toList = foldr (::) []
365toList = foldr (::) []
367+--------------------------------------------------------------------------------
369+--------------------------------------------------------------------------------
371+||| The scanl function is similar to foldl, but returns all the intermediate
372+||| accumulator states in the form of a list.
375+|||scanl (+) 0 [1,2,3,4]
377+scanl : (b -> a -> b) -> b -> List a -> List b
379+scanl f q (x::xs) = q :: scanl f (f q x) xs
381+||| The scanl1 function is a variant of scanl that doesn't require an explicit
383+||| It assumes the first element of the list to be the starting value and then
384+||| starts the fold with the element following it.
387+|||scanl1 (+) [1,2,3,4]
389+scanl1 : (a -> a -> a) -> List a -> List a
391+scanl1 f (x::xs) = scanl f x xs
367--------------------------------------------------------------------------------
393--------------------------------------------------------------------------------
368-- Transformations
394-- Transformations
369--------------------------------------------------------------------------------
395--------------------------------------------------------------------------------