Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
The need to specify 'rec' in a recursive function defintion
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-02-09 (22:32)
From: Saptarshi Guha <saptarshi.guha@g...>
Subject: Re: [Caml-list] The need to specify 'rec' in a recursive function defintion
Yes, I see  that f isn't recursive, because it simplifies down to
2*(x+1) but for a reader(at least myself)  it can be bit tricky to
consume. My experience of reading the /definition/ of a function which
includes a call
to itself is that it is recursive. On the stackoverflow post, you
mentioned that the British ML branch forces different names (since
recursion is by default), and though it does pollute the namespace,
personally I find it easier to read.


>> Wouldn't one of way of detecting a recursive function would be to see
>> if the indeed the function calls itself?
>  let f x = x + 1
>  let f x = 2 * f x
> Is the latter "f" recursive or not?
> See my answer to the same question on stack overflow:
> --
> Dr Jon Harrop, Flying Frog Consultancy Ltd.