English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Warning on not-tail recursive functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-04 (19:24)
From: Oliver Bandel <oliver@f...>
Subject: Re: [Caml-list] Warning on not-tail recursive functions
Zitat von Brian Hurt <bhurt@spnz.org>:

> On Sat, 4 Aug 2007, Oliver Bandel wrote:
> > What ist with a
> >
> >  ...
> >   ignore (maybe_tailcall())
> >  ...
> >
> That is not a tail call.  You're using the value it returns.

Yes, but ignore ignores the value,
and my question was regarded to THIS CERTAIn aspect:
if it INTERNALLY would mean that the arguments will not be created,
then nothing must be given back and if no further commands are
following (read the "..." under the ignore-call as the next
pattern of a pattern match, not as a command that follows the ignore(..)).

> Brian
> > Does ignore REALLY ignore the values (does not generate them), so that
> > this call is like a true tail-call, or will the maybe_tailcall
> > generate and give back results to the ignore-call and then
> > ignore throws away the stuff (then it would be NO tailcall).
> Throwing away the result is using the result.

Ignoring a result in a way that it will never be created, would mean
to have no result => this would be tailcall-equivalent.

And that was my question! Would ignore throw away the
created results, or would it suppress creating results?!

Now some answers wer: results will be treated and thrown away afterwards.

Then a next question could arise: could it be implemented in a way, that
creating the results would be blocked from the beginning on (so that nothing
must be thrown away, because nothing would be created)?

This is not really an urgent question, only something,
that during the last two days sometimes came to my mind.