[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Expunge LETREC, BEGIN and SEQUENCE.
I have a proposal that eliminates the need to
modify lambda environments by local defines,
and at the same time eliminates the need for
LETREC, BEGIN and SEQUENCE.
For expository purposes, I will introduce the
special form DECLARE defined as:
(DEFINE a z)
(DEFINE b y)
(DEFINE e r)
In clsch, the macro is:
(define-macro (declare . forms)
(let loop ((forms forms)
(let ((def (car forms)))
(if (and (pair? def) (eq? 'define (car def)))
(loop (cdr forms) (cons (cdr def) decls))
`(letrec ,decls . ,forms)))))
Clearly, DECLARE is a simple generalization of BEGIN.
It allows LETREC-like declarations in DEFINE syntax.
This interpretation of local defines suggests that they
do not modify environments, but create their own. I'm
sure that will help those interested in good code.
My proposal is to treat every sequence of statements as
a DECLARE form. This includes the bodies of LAMBDAs,
LETs, DOs and COND clauses minus the guard. Then we can
expunge LETREC, BEGIN and SEQUENCE.