From: Alain Frisch <alain@frisch.fr>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] The need to specify 'rec' in a recursive function defintion
Date: Wed, 10 Feb 2010 04:10:34 +0100 [thread overview]
Message-ID: <4B7223AA.5020000@frisch.fr> (raw)
In-Reply-To: <4B71F8C3.5080306@citycable.ch>
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
next prev parent reply other threads:[~2010-02-10 3:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-09 20:50 Saptarshi Guha
2010-02-09 21:55 ` [Caml-list] " Guillaume Yziquel
2010-02-09 22:14 ` Saptarshi Guha
2010-02-09 22:01 ` Gerd Stolpmann
2010-02-09 21:58 ` Guillaume Yziquel
2010-02-09 22:34 ` Gerd Stolpmann
2010-02-10 0:07 ` Guillaume Yziquel
2010-02-10 3:10 ` Alain Frisch [this message]
2010-02-09 22:16 ` Saptarshi Guha
2010-02-09 23:29 ` Jon Harrop
2010-02-10 10:15 ` rossberg
2010-02-10 7:19 ` Andrej Bauer
2010-02-10 9:36 ` Francois Maurel
2010-02-10 10:12 ` rossberg
2010-02-09 23:33 ` Jon Harrop
2010-02-09 22:31 ` Saptarshi Guha
2010-02-10 0:12 ` Jon Harrop
2010-02-10 22:01 ` Stefan Monnier
2010-02-10 22:25 ` [Caml-list] " Till Varoquaux
2010-02-11 1:48 ` Jon Harrop
2010-02-15 15:46 ` Stefan Monnier
2010-02-15 17:33 ` [Caml-list] " Jon Harrop
2010-02-15 20:36 ` Stefan Monnier
2010-02-16 14:42 ` Stefan Monnier
2010-02-16 16:21 ` [Caml-list] " Ashish Agarwal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B7223AA.5020000@frisch.fr \
--to=alain@frisch.fr \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox