[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] Formal Comment: what is the required behavior of 'lazy'?

Yesterday, Alex Shinn wrote:
> On Thu, Jun 28, 2012 at 1:39 AM, Eli Barzilay <eli@x> wrote:
> > A few minutes ago, Alex Shinn wrote:
> >> On Thu, Jun 28, 2012 at 1:12 AM, Eli Barzilay <eli@x> wrote:
> >> > With both present, there is an easy way to remember which one to
> >> > choose: `lazy'.
> >>
> >> `delay' is useful for many other things besides streams, where
> >> `lazy' would not be applicable.
> >
> > For example...?
> Do you honestly doubt that the concept of delayed
> evaluation has uses outside of a stream?
> In the most basic case it serves as a simple cache:
>   (let ((x (delay <expr>)))
>      ...
>      (if ... (force x) ...)
>      ...
>      (if ... (force x) ...))
> Lazy doesn't work here.

*Some* `lazy's do.  I missed the fact that you've crippled `lazy'.
(It's an odd decision that not only makes it a more limited tool, it also
contradicts a dynamically typed language.)

> This allows arbitrary non-procedure values to refer to each other
> directly without concern for the order they occur in the original
> macro syntax (cycles are problematic but I used this in a syntax
> where cycles were not meaningful).

Yes, I'm somewhat familiar with lazy languages.  (Which, BTW, is how
the uncrippled `lazy' came in.)

> People were using delay for a long time before lazy came along.

Yes, I'm also somewhat familiar with their history.  An unrestricted
`lazy' can supersede `delay'.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Scheme-reports mailing list