diff options
author | Alexander Abushkevich <alex@abushkevi.ch> | 2016-02-23 00:49:17 +1300 |
---|---|---|
committer | Alexander Abushkevich <alex@abushkevi.ch> | 2016-02-23 01:30:31 +1300 |
commit | 746e16d83aaf284f996bcc6d61f0d9ba99c099b2 (patch) | |
tree | 8312b8bdcce9d7ef468abb6e86d0dc3a4d97b5e4 /lib/ur/list.urs | |
parent | 5705d3b510277f033b8a0317b3fe520b0e5cc60a (diff) |
Find longest prefix of elements, which satisfy a predicate; Group a list
Diffstat (limited to 'lib/ur/list.urs')
-rw-r--r-- | lib/ur/list.urs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ur/list.urs b/lib/ur/list.urs index 55068935..ac874d7c 100644 --- a/lib/ur/list.urs +++ b/lib/ur/list.urs @@ -105,3 +105,9 @@ val recToList : a ::: Type -> r ::: {Unit} -> folder r -> $(mapU a r) -> t a 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 + +(** Longest prefix of elements, which satisfy a predicate *) +val span : a ::: Type -> (a -> bool) -> t a -> t a * t a + +(** Group a list *) +val groupBy : a ::: Type -> (a -> a -> bool) -> t a -> t (t a) |