]> matita.cs.unibo.it Git - fireball-separation.git/blobdiff - ocaml/listx.ml
still stepping on negative variables
[fireball-separation.git] / ocaml / listx.ml
index ecc8a920f1019c94abe3238780dccf21618c2473..821e281d5e9d94fa426b6aa2bb62fcccff2efc53 100644 (file)
@@ -56,6 +56,10 @@ let rec max =
   | Nil x -> x
   | Cons (x, l) -> Pervasives.max x (max l)
 
+let rec last =
+  function
+  | Nil x -> x
+  | Cons (_, l) -> last l
 (*
 let rec nth i l = match l, i with
  | Cons (x, _), 1  -> x
@@ -65,4 +69,3 @@ let rec nth i l = match l, i with
  | Nil _, _        -> raise (Invalid_argument "Listx.nth")
 ;;
 *)
-