[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Scheme-reports] Formal Comment: what is the required behavior of 'lazy'?
A few minutes ago, Alex Shinn wrote:
> On Fri, Jun 29, 2012 at 9:32 AM, Eli Barzilay <eli@x> wrote:
> > 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.)
> I'm only aware of one definition of `lazy' - the one from srfi-45
> and used by srfi-41. If there is an alternative definition I'd like
> to know.
It's one that does not require to be used with a promise.
Welcome to Racket v5.2.1.
-> (lazy 1)
-> (force ^)
-> (force (lazy (lazy 2)))
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
Scheme-reports mailing list