Ajout de list_remove (a mettre dans List?)

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2268 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Leroy 1999-02-04 10:32:27 +00:00
parent 3de8dc0312
commit a0257345ce
2 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,11 @@ let rec mem_assq x = function
let rec replicate_list elem n =
if n <= 0 then [] else elem :: replicate_list elem (n-1)
let rec list_remove x = function
[] -> []
| hd :: tl ->
if hd = x then tl else hd :: list_remove x tl
(* File functions *)
let find_in_path path name =

View File

@ -25,6 +25,9 @@ val mem_assq: 'a -> ('a * 'b) list -> bool
val replicate_list: 'a -> int -> 'a list
(* [replicate_list elem n] is the list with [n] elements
all identical to [elem]. *)
val list_remove: 'a -> 'a list -> 'a list
(* [list_remove x l] returns a copy of [l] with the first
element equal to [x] removed *)
val find_in_path: string list -> string -> string
(* Search a file in a list of directories. *)