Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] recursive or loop
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alan Falloon <Al.Falloon@s...>
Subject: Re: [Caml-list] recursive or loop
Michael Wohlwend wrote:
> On Monday 06 March 2006 20:25, Anil Madhavapeddy wrote:
>   
>> To answer your original question, I wouldn't get too religious about
>> recursive vs imperative styles; OCaml lets you choose and mix them,
>> so pick the one that gets the job done for you and move on to the
>> finer things in life :-)
>>     
>
> yop, that's true; it's just that in my case the recursive version is pretty 
> nice :-)
>   
If you can easily convert it to a tail-recursive function, then you 
don't need to record any stack info, and its as easy as recording the 
current arguments like Jon Harrop pointed out.

Converting a recursive function to a tail-recursive one is as hard as 
converting it to an interative algorithm: the two forms are pretty much 
the same.

--
Alan Falloon