summaryrefslogtreecommitdiff
path: root/lib/ur/list.urs
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-12-11 15:02:55 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2011-12-11 15:02:55 -0500
commit4f67fe6cd314ad3ca1286766f1f9f3d8c5084d48 (patch)
tree7d5004cf0d36df0abdb259ed724d4cb14f2ac8e6 /lib/ur/list.urs
parent02f3311b6fd7af07e63b5a0df2598b148783fd61 (diff)
Some new List functions, based on code by Ron de Bruijn
Diffstat (limited to 'lib/ur/list.urs')
-rw-r--r--lib/ur/list.urs8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ur/list.urs b/lib/ur/list.urs
index 2a28d148..15204590 100644
--- a/lib/ur/list.urs
+++ b/lib/ur/list.urs
@@ -46,6 +46,9 @@ val foldlM : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type
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 @@ val assocAdd : a ::: Type -> b ::: Type -> eq a -> a -> b -> t (a * b) -> t (a *
(** 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