From: Michael Wohlwend <micha-1@fantasymail.de>
To: Alan Falloon <Al.Falloon@synopsys.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] recursive or loop
Date: Wed, 8 Mar 2006 08:53:30 +0100 [thread overview]
Message-ID: <200603080853.30925.micha-1@fantasymail.de> (raw)
In-Reply-To: <440DAEA3.1000204@synopsys.com>
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
next prev parent reply other threads:[~2006-03-08 7:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-06 17:25 Jonathan Harrop
2006-03-06 18:25 ` Michael Wohlwend
2006-03-06 18:31 ` Thomas Fischbacher
2006-03-08 19:07 ` Matthew O'Connor
2006-03-08 21:56 ` Thomas Fischbacher
2006-03-08 22:10 ` Till Varoquaux
2006-03-08 22:13 ` Thomas Fischbacher
2006-03-08 23:28 ` Jon Harrop
2006-03-06 19:25 ` Anil Madhavapeddy
2006-03-06 21:22 ` Michael Wohlwend
2006-03-07 16:02 ` Alan Falloon
2006-03-08 7:53 ` Michael Wohlwend [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-03-06 13:33 Jonathan Harrop
2006-03-06 14:15 ` Thomas Fischbacher
2006-03-06 16:42 ` Michael Wohlwend
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200603080853.30925.micha-1@fantasymail.de \
--to=micha-1@fantasymail.de \
--cc=Al.Falloon@synopsys.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox