[clazy-devel] Fwd: More interesting stuff

szergling senatorzergling at gmail.com
Sun Mar 8 09:40:05 UTC 2009


---------- Forwarded message ----------
From: szergling <senatorzergling at gmail.com>
Date: Thu, Feb 26, 2009 at 6:41 PM
Subject: Re: More interesting stuff
To: Marco Antoniotti <marcoxa at gmail.com>

[[...]]

After thinking more, I still regard let as being different from letrec
(saying this as a Lisper, Haskeller might very well have different
expectations). I have a better example to show my confusion. Assuming
full laziness, I expect the following --

(let ((x 1))
 (let ((x (cons 1 x)))
   x))
=> (1 . 1)

(let ((x 1))
 (letrec ((x (cons 1 x)))
    x))
=> (1 1 1 1 1 ...)

That's why I think we need to be able to differentiate between let and letrec.

> Finally, I took some decisions w.r.t. your suggestions.
> I made two block-like blocks, called LAZILY (and SLACKING: I kind of like
> this one) in lieu of WITH-LAZINESS. So now you can do
>     (lazily (print 42) (cons (loop) 42))
> and CONS *will* be called lazily.  You code-walking solution was the right
> one.

Code-walking is hard... my example was only a hack. It's completely
buggy at the moment, but even if it works, it will fail on "confusing
names" in "confusing positions", for example,

(let ((car 2))
 ...)

or (lambda (car ...) ...)

Might have to bring in Arnesi...




More information about the Clazy-devel mailing list