caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Till Varoquaux <till@pps.jussieu.fr>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Re: The need to specify 'rec' in a recursive function  defintion
Date: Wed, 10 Feb 2010 17:25:44 -0500	[thread overview]
Message-ID: <9d3ec8301002101425k356b92e0p6ca2690d8cd6399d@mail.gmail.com> (raw)
In-Reply-To: <jwvfx58wy1c.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org>

On Wed, Feb 10, 2010 at 5:01 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> Wouldn't one of way of detecting a recursive function would be to see
>> if the indeed the function calls itself?
>
> That's what Haskell does, yes.
>
>

Let's make things clear here: the "rec" *really* is a feature; it is
very convenient to reuse the same identifier to express something in
the process of being built (e.g. something going through a pipeline).

For instance:

let g () =
  let f s =
    if !debug then
       Printf.printf "f is called with value: %s\n%!" s
    f s
  in
  .......

Some (including me) would even argue that it is sad that type
definitions don't use "rec".

Till
>        Stefan
>
> _______________________________________________
> 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
>


  reply	other threads:[~2010-02-10 22:25 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
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   ` Till Varoquaux [this message]
2010-02-11  1:48     ` [Caml-list] " 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=9d3ec8301002101425k356b92e0p6ca2690d8cd6399d@mail.gmail.com \
    --to=till@pps.jussieu.fr \
    --cc=caml-list@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;
as well as URLs for NNTP newsgroup(s).