[plt-scheme] Comments on an alternate syntax for let?
In the comp.lang.lisp post [The syntax of LET] by Jeff M, hed wondered
why the syntax of let wasn't simpler, like; (let (x 0 y 1 z 2) (+ x y
z)). Someone proposed he write a macro.
I wrote a macro for Scheme. May you please evaluate it? (no pun intended)
Here it is:
(define-syntax (my-let stx)
(syntax-case stx ()
[(_ (var val rest ...) exp1 exp2 ...)
#'(let ([var val])
(_ (rest ...) exp1 exp2 ...))]
[(_ () exp1 exp2 ...)
#'(let ()
exp1 exp2 ...)]
[(_)
((raise-syntax-error #f "at least one expression in the body is
required" stx))]
[(_ (var) exp1 exp2 ...)
(raise-syntax-error #f "binding list must be even" (syntax var))]))
--
http://www.wisdomandwonder.com/