on master help sign in
Merge pull request #1261 from jeffersoncarpenter/vect-foldr

Added foldr1 method to Vect.idr

commit4bd9c2ae6d815366a98cd93ec09672ace6f68bc1 authorEdwin Brady <edwin.brady@gmail.com> dateWed 28 May 2014, 18:00 (12 years ago) parent00793ac43d33b3
1 file changed+4
libs/prelude/Prelude/Vect.idr+4
libs/prelude/Prelude/Vect.idr+4
@@ -254,6 +254,10 @@ concat : Vect m (Vect n a) -> Vect (m * n) a
254254concat [] = []
255255concat (v::vs) = v ++ concat vs
256256
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+
257261--------------------------------------------------------------------------------
258262-- Scans
259263--------------------------------------------------------------------------------