[plt-scheme] Comments on an alternate syntax for let?
Majorinc, Kazimir
kazimir at chem.pmf.hr
Tue Apr 8 12:50:46 EDT 2008
> (let ()
> (define x 1)
> (define y 6)
> (let ()
> (define x (add1 x))
> (define y (sub1 y))
> (+ x y)))
> add1: expects argument of type <number>; given #<undefined>
I see. Internal defines behave like they are the binding parts of
letrec, top level defines like they are the binding parts of let*.
(define x 1)
(define x (add1 x))
(define y (add1 x))
(+ x y)
is equivalent to
(let* ((x 1)
(x (add1 x))
(y (add1 x)))
(+ x y))
Am I right?
It complicates writing macros that use define, because they should work
on both levels. Is it possible to separate the functionalities lumped
together in define and various lets into something like
(bind x)
(assign x ...)
(scope ...)
(sequentially ...)
(simultaneously ... )?
We already have assign = set!, scope = let(), sequentially = begin. Is
there something in PLT that can be used for "simultaneously" and "bind"?
More information about the plt-scheme
mailing list