diff options
| author | Xavier Leroy <xavier.leroy@inria.fr> | 1995-06-18 14:45:56 +0000 |
|---|---|---|
| committer | Xavier Leroy <xavier.leroy@inria.fr> | 1995-06-18 14:45:56 +0000 |
| commit | 101bb8b8a786bdfdeb44cdc8390b1f8fc18883cd (patch) | |
| tree | 3d21bc4e7e5fab848710d7f005caa033205c0c6b /stdlib/list.ml | |
| parent | e0f3c043e5dd7ad4dbec7feb15b9c7a23ebecb2d (diff) | |
| download | ocaml-101bb8b8a786bdfdeb44cdc8390b1f8fc18883cd.tar.gz | |
Changement representation des constructeurs constants.
list: ajout de nth
obj: %is_block devient une fonction C.
parsing: le tableau transl est coupe en transl_const et transl_block.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@41 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'stdlib/list.ml')
| -rw-r--r-- | stdlib/list.ml | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/stdlib/list.ml b/stdlib/list.ml index 3b6cdb4402..6a6f1f9097 100644 --- a/stdlib/list.ml +++ b/stdlib/list.ml @@ -12,6 +12,11 @@ let tl = function [] -> failwith "tl" | a::l -> l +let rec nth l n = + match l with + [] -> failwith "nth" + | a::l -> if n <= 0 then a else nth l (n-1) + let rec rev_append accu = function [] -> accu | a::l -> rev_append (a :: accu) l |
