Browse thread
Re: [Caml-list] recursive or loop
[
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: | Michael Wohlwend <micha-1@f...> |
| Subject: | Re: [Caml-list] recursive or loop |
On Tuesday 07 March 2006 17:02, Alan Falloon wrote: > 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. I have indeed some problems converting it to a loop or to a tail-recusrsive function. It's of the form: let rec search result = if some_test then record_the result else begin iter (fun element -> iter (fun ...); search (element :: result); (* !!! *) iter (fun ...); ) data end ;; so the recursive call is in the middle and in an List.iter statment :-( cheers Michael