]> matita.cs.unibo.it Git - helm.git/commitdiff
added skip function
authorEnrico Tassi <enrico.tassi@inria.fr>
Wed, 24 Sep 2008 14:48:36 +0000 (14:48 +0000)
committerEnrico Tassi <enrico.tassi@inria.fr>
Wed, 24 Sep 2008 14:48:36 +0000 (14:48 +0000)
helm/software/components/extlib/hExtlib.ml
helm/software/components/extlib/hExtlib.mli

index fe0f417cdf88521a401a54d0ebbf41ba79ef0b58..6af86f9cd4d4ac0b620d004976ea6a83fc951a6e 100644 (file)
@@ -529,3 +529,10 @@ let list_seq start stop =
     aux start
 ;;
 
+let rec list_skip n l =
+  match n,l with
+  | 0,_ -> l
+  | n,_::l -> list_skip (n-1) l
+  | _, [] -> assert false
+;;
+
index 96e7a398cbe275d2148eca4ec6be0e637a3a7b23..a92389feab9512be90bafaccc9cb2b84b51edc68 100644 (file)
@@ -108,6 +108,9 @@ val list_forall_default3: ('a -> 'b -> 'c -> bool) -> 'a list -> 'b list -> 'c -
    * @raise Failure when List.length l < n *)
 val split_nth: int -> 'a list -> 'a list * 'a list
 
+ (** skip [n] [l] skips the first n elements of l *)
+val list_skip : int -> 'a list -> 'a list
+
 val mk_list: 'a -> int -> 'a list
 
 (* makes the list [start; ...; stop - 1] *)