Lambda the Ultimate

inactiveTopic Quick links
started 6/9/2002; 11:47:36 PM - last post 6/11/2002; 10:59:21 AM
Ehud Lamm - Quick links  blueArrow
6/9/2002; 11:47:36 PM (reads: 578, responses: 4)
Quick links
Patrick Logan is having a good day:

  1. Lazy evaluation
  2. CS education
  3. Monads
  4. Tuple spaces

Posted to general by Ehud Lamm on 6/9/02; 11:47:48 PM

Ed Heil - Re: Quick links  blueArrow
6/10/2002; 1:56:59 AM (reads: 610, responses: 2)
RE Lazy Eval in Scheme.... Is there any difference between:

(define whatever (delay yadda)) ... (force whatever)

and

(define whatever (lambda () yadda)) ... (whatever)

?

Ehud Lamm - Re: Quick links  blueArrow
6/10/2002; 5:35:53 AM (reads: 661, responses: 1)
The value of a promises is computed once, no matter how many times the promise is forced.

Dan Shappir - Re: Quick links  blueArrow
6/10/2002; 8:25:15 AM (reads: 731, responses: 0)

Interestingly, while I still had the time for it, I thought about extending the lazy evaluation Sjoerd and I had created (the Beyond lib) with this feature. Interesting because the implementation I had thought about was very similar to the Scheme impl, without my being aware of it.

My basic idea was to wrap the expression inside a function. The first time the value is requested it's calculated and the result is tacked as a property onto the function object. Something like:

function sum() { return 1 + 2; }

function force(f) {
    return "result" in f ? f.result : f.result = f();
}

var a = force(sum);
var b = force(sum);

Ed Heil - Re: Quick links  blueArrow
6/11/2002; 10:59:21 AM (reads: 565, responses: 0)
Thanks, Ehud. I knew there must be an important distinction; I can't imagine anything redundant creeping into the Scheme spec. :)