diff lib/ur/list.urs @ 1634:f4cb4eebf7ae

Some new List functions, based on code by Ron de Bruijn
author Adam Chlipala <adam@chlipala.net>
date Sun, 11 Dec 2011 15:02:55 -0500
parents 553a5cc3a4b5
children a613cae954ca
line wrap: on
line diff
--- a/lib/ur/list.urs	Mon Dec 05 10:43:06 2011 -0500
+++ b/lib/ur/list.urs	Sun Dec 11 15:02:55 2011 -0500
@@ -46,6 +46,9 @@
 val foldlMi : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type
              -> (int -> a -> b -> m b) -> b -> t a -> m b
 
+val filterM : m ::: (Type -> Type) -> monad m -> a ::: Type
+              -> (a -> m bool) -> t a -> m (t a)
+
 val foldlMap : a ::: Type -> b ::: Type -> c ::: Type
                -> (a -> b -> c * b) -> b -> t a -> t c * b
 
@@ -90,3 +93,8 @@
 (** Converting records to lists *)
 
 val recToList : a ::: Type -> r ::: {Unit} -> folder r -> $(mapU a r) -> t a
+
+(* Divide a list into two sections at a particular 0-based position, returning the second, first, or both parts, respectively. *)
+val drop : t ::: Type -> int -> list t -> list t
+val take : t ::: Type -> int -> list t -> list t
+val splitAt : t ::: Type -> int -> list t -> list t * list t