Browse thread
The need to specify 'rec' in a recursive function defintion
-
Saptarshi Guha
- Guillaume Yziquel
- Gerd Stolpmann
- Jon Harrop
-
Stefan Monnier
- Till Varoquaux
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Till Varoquaux <till@p...> |
| Subject: | Re: [Caml-list] Re: The need to specify 'rec' in a recursive function defintion |
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
>