@@ -326,10 +326,20 @@ foldl1 f (x::xs) = foldl f x xs
327--------------------------------------------------------------------------------
327--------------------------------------------------------------------------------
329+||| The scanl function is similar to foldl, but returns all the intermediate
330+||| accumulator states in the form of a vector.
329scanl : (res -> elem -> res) -> res -> Vect len elem -> Vect (S len) res
331scanl : (res -> elem -> res) -> res -> Vect len elem -> Vect (S len) res
330scanl f q [] = [q]
332scanl f q [] = [q]
331scanl f q (x::xs) = q :: scanl f (f q x) xs
333scanl f q (x::xs) = q :: scanl f (f q x) xs
335+||| The scanl1 function is a variant of scanl that doesn't require an explicit
337+||| It assumes the first element of the vector to be the starting value and then
338+||| starts the fold with the element following it.
339+scanl1 : (elem -> elem -> elem) -> Vect len elem -> Vect len elem
341+scanl1 f (x::xs) = scanl f x xs
333--------------------------------------------------------------------------------
343--------------------------------------------------------------------------------
334-- Membership tests
344-- Membership tests
335--------------------------------------------------------------------------------
345--------------------------------------------------------------------------------