Re: Crazy macro



In that case the tags are redundant. All you need is a privileged
symbol (\... would seem like a natural choice) to indicate that it is to
be replaced by the subsequent form, e.g.:

(control-nest
(multiple-value-let (x y) (frob) \...)
(multiple-value-let (q z) (blurp) (foo \...))
etc...
)

True, but the tags can be quite mnemonic. For instance, suppose you
have what is conceptually a conjunction of conditions to test, but
because of ancillary variable binding you wind up with let's and
cond's cluttering the code up. Then you could write

(control-nest
(let ((...))
(cond ((unusual-case)
(bail))
(t
:and)))
:and
(multiple-value-let (...)
(cond ((check-next-condition)
:and)
(t
(bomb))))
:and
...)

More usually, the tags can indicate the next phase. For example, in a
grading program, the macro got used thus (where I've deleted everything

that doesn't contribute to the nesting):

(control-nest
(let (...)
[... ]
(cond ((or (> group-size 0)
avoid-empty-grade-pop*)
:collect-next-group)))

:collect-next-group
(let (...)
[...]
(multi-let (((group group-weight rem-students rem-weights)
(weighted-take num-to-take
to-be-curved
remaining-weights)))
[...]
(cond ((not (null group))
[...]
:collect-squeakers))))

:collect-squeakers
;; Add to group those who missed the bottom by a fraction
;; of a point
(let* (...)
[...]
(let (...)
[...]
(let* ((num-squeakers (len squeakers))
(squeakers-weight
(<< + (take num-squeakers
remaining-weights))))
[...]
(cond ((not (null squeakers))
[...]))))))

You see why Vietnamization is a problem in my code!

-- Drew

.