Browse thread
The need to specify 'rec' in a recursive function defintion
-
Saptarshi Guha
-
Guillaume Yziquel
- Saptarshi Guha
- Gerd Stolpmann
- Jon Harrop
- Stefan Monnier
-
Guillaume Yziquel
[
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: | 2010-02-09 (22:14) |
From: | Saptarshi Guha <saptarshi.guha@g...> |
Subject: | Re: [Caml-list] The need to specify 'rec' in a recursive function defintion |
Thanks, very helpful. >> let f = fun x -> x + 1 (1) >> >> let f x = f (f x) (2) This works in ocaml because, it replaces f (in (2) ) from that of (1). Which is why i need f previously defined. Correct me if i'm wrong. > >> Wouldn't one of way of detecting a recursive function would be to see >> if the indeed the function calls itself? > > No. Because you never know if you intended to call the function recursively, > or if you intended to call an homonymous function you defined before. > Very true, hadn't considered this. > All the best, > > -- > Â Â Guillaume Yziquel > http://yziquel.homelinux.org/ >