aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2003-04-16 22:19:15 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2003-04-16 22:19:15 +0000
commit391605f6195f92603ca960014db302dc79e6d24f (patch)
tree42a7c7dd1d5b20f46b0ec65751fecc24fa101cdd /lib
parent49374be0e27c50a5e3b4733e4d53fd5228741f83 (diff)
une fonction list_skipn qui zappe les n premiers elements d'une liste
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@3930 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
-rw-r--r--lib/util.ml5
-rw-r--r--lib/util.mli1
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/util.ml b/lib/util.ml
index 982546ca9..6d9cf16b3 100644
--- a/lib/util.ml
+++ b/lib/util.ml
@@ -291,6 +291,11 @@ let list_lastn n l =
in
if len < n then failwith "lastn" else aux len l
+let rec list_skipn n l = match n,l with
+ | 0, _ -> l
+ | _, [] -> failwith "list_fromn"
+ | n, _::l -> list_skipn (pred n) l
+
let list_prefix_of prefl l =
let rec prefrec = function
| (h1::t1, h2::t2) -> h1 = h2 && prefrec (t1,t2)
diff --git a/lib/util.mli b/lib/util.mli
index e7a99acd2..a18608712 100644
--- a/lib/util.mli
+++ b/lib/util.mli
@@ -102,6 +102,7 @@ val list_split3 : ('a * 'b * 'c) list -> 'a list * 'b list * 'c list
val list_firstn : int -> 'a list -> 'a list
val list_last : 'a list -> 'a
val list_lastn : int -> 'a list -> 'a list
+val list_skipn : int -> 'a list -> 'a list
val list_prefix_of : 'a list -> 'a list -> bool
(* [map_append f [x1; ...; xn]] returns [(f x1)@(f x2)@...@(f xn)] *)
val list_map_append : ('a -> 'b list) -> 'a list -> 'b list