caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jonathan Roewen <jonathan.roewen@gmail.com>
To: skaller <skaller@users.sourceforge.net>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] HOFs, recursion, and being tail-rec...
Date: Mon, 13 Feb 2006 15:47:07 +1300	[thread overview]
Message-ID: <ad8cfe7e0602121847q53985635v4af48705831e2aa3@mail.gmail.com> (raw)
In-Reply-To: <1139796314.8591.79.camel@rosella.wigram>

> So it isn't a well formed sentence to say depth first
> search cannot be tail-rec, it is easy to construct a
> depth first search in any FPL that is.
>
> However, no matter what you do, you will indeed need
> memory linear in the tree depth (unless it is 1-ary tree as
> pointed out).

Yes, but tail-rec would mean the function call trace does not use
memory linear in the tree depth, which would be a positive
optimisation. BTW: the memory linear to the tree depth is used in the
list passed to search, 'visited'.

I'm just wondering if using List.exists and HOFs prevents the compiler
from generating tail-rec code (I presume that List.exists is already
tail-rec). As it wouldn't be hard to make it tail-rec I'd imagine..

Jonathan


  reply	other threads:[~2006-02-13  2:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-12 22:08 Jonathan Roewen
2006-02-12 23:53 ` Jacques Garrigue
2006-02-13  2:05   ` skaller
2006-02-13  2:47     ` Jonathan Roewen [this message]
2006-02-13  3:23       ` skaller

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=ad8cfe7e0602121847q53985635v4af48705831e2aa3@mail.gmail.com \
    --to=jonathan.roewen@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=skaller@users.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).