Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Generation of streams is slow
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Alexander V. Voinov <avv@q...>
Subject: Re: [Caml-list] Generation of streams is slow


Daniel de Rauglaudre wrote:
> 
> Hi,
> 
> On Sat, Jul 14, 2001 at 11:08:09AM -0700, Alexander V. Voinov wrote:
> 
> >     h::(make_tail arg1 argN),
> > that is
> >       CALL make_tail
> >       CONS
> > and change them to
> >       PREPARE_CONS
> >       CALL make_tail
> > the scope of tail recursion optimization would increase. But it's
> > unlikely that this idea didn't come to developers. Which may mean that
> > this [being not that simple] is impossible.
> 
> It supposes that the order of evaluation could be variable. If we
> imagine a constructor C with 5 parameters. If we evalutate:
> 
>       C (a, b, c, d, e)

I don't understand, however, the argument about the order of evaluation
in _this_ case, that is of h::(make_tail args). The value of `h' is
supposed to be computed to this point, and whatever side effects are
present in `make_tail', they cannot influence the result of ::, which is
context-independent. The only difference might be the exceptions, which
can appear in `make_tail' and propagate somewhere, but the result will
not be returned anyway (the call to :: is supposed to be the _last_), so
it doesn't matter if :: is prepared to accept it or not.

Or to introduce a special version of ::, say :!:, which ensures that the
call to make_tail is really the last.

Alexander
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr