Hi Maciek,

Just picking up another point from your original email.  You may have
already worked this out, but just in case...

2008/7/11 Maciek Godek <[EMAIL PROTECTED]>:
>
> Additionaly, it would be nice to see the possibility
> of explicit definitions of environments, like:
>
> (define env (make-closure (a . 1)(b . 2))
> (with env (define c 3))

This is equivalent to:
(define env (let ((a 1) (b 2)) (the-environment)))
(local-eval '(define c 3) env)

except that the last line fails with a "Bad define placement" error.
That's because there are special rules for defines inside lexical
scopes.

> so that we could define the aforementioned
> counter as:
> (define counter-env (make-closure (c . 0)))
> (define ++ (with counter-env (lambda()(set! c (1+ c))c)))

This one really works:

(define counter-env (let ((c 0)) (the-environment)))
(define (++) (local-eval '(begin (set! c (+ c 1)) c) counter-env))

So, in summary, make-closure wouldn't provide anything more than what
we already have.

Regards,
        Neil


Reply via email to