on master help sign in
Added foldr1 method to Vect.idr
43d33b3Jefferson Carpenter
libs/prelude/Prelude/Vect.idr+4
@@ -254,6 +254,10 @@ concat : Vect m (Vect n a) -> Vect (m * n) a
254concat [] = []
254concat [] = []
255concat (v::vs) = v ++ concat vs
255concat (v::vs) = v ++ concat vs
256
256
257+||| Fold without seeding the accumulator
258+foldr1 : (t -> t -> t) -> Vect (S n) t -> t
259+foldr1 f (x::xs) = foldr f x xs
260+
257--------------------------------------------------------------------------------
261--------------------------------------------------------------------------------
258-- Scans
262-- Scans
259--------------------------------------------------------------------------------
263--------------------------------------------------------------------------------