[racket] iterative lazy space-safe or not?

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Nov 16 23:34:12 EST 2010

Earlier today, Keiko Nakata wrote:
> > > It looks clever.
> > 
> > I'm not sure that it's a good term -- you've seen the comment above
> > it?
> 
> Sure. I read the source, papers by R. Jones and Wadler.
> I thought you have measurement.

I don't have any concrete measurements.  The implementation is as fast
as I could make it, but it's still pretty slow -- for example, when
you compare it with a naive implementation.  Most of the hit is due to
doing the right thing wrt exceptions: when there's an exception when a
promise is forced, the exception is stored as the "value" and will be
re-raised when forced again.  For example, if you do this:

  (define a (delay (/ (random 2))))
  (force a)

and get an error, you should get an error for future forces too.


> It's simple and works, which is nice; isn't it?

It's very fragile, and when it breaks it's very hard to find out how
to fix it.

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


Posted on the users mailing list.