On 2/10/2010 1:07 AM, Guillaume Yziquel wrote:
Is it possible to have polymorphic recursion with vanilla 'let rec'
invocations?
This is something that Jacques recently merged in the current
development branch. The code below should work with OCaml 3.12.
let length v =
let rec f : 'a. int -> 'a vec -> int = fun n l -> match l with
Nil -> n
| Zero ps -> f (2 * n) ps
| One (_, ps) -> f (1 + 2 * n) ps
in
f 0 v
-- Alain
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs