[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nested backquotes

The problem with "explanations" of backquote is that they tend to be
much longer than the "production rules" on CLtL p.349-50.  Of course,
the problem with CLtL here is opacity.

The only rule I ever remember, and found quite useful, is:

   "When in doubt, Hack it out."

In short, after implementing the rules of CLtL rigorously, then I just
try reading (and sometimes macroexpanding) several variants of the form
I'm trying to build up.  Apart from ultimately matching the depth of
nesting for commas and backquotes, I just try a lot of variations of
",," ",'," ",,@" etc.  You'd be surprised how useful the "hack it out"
rule is!  especially in leanring when ",'," must be used instead of ",,".

One program I was writing once wound up 6 levels deep; the "hack it out"
rule wasn't very helpful here, because the expression was too large.
Ultimately, I wound up finding a "break point", and pulled out some of
the code into a separate function, much as you originally did in your
first example with BUILD-LET-LIST.  At that point it was 4 levels and 2
levels -- much more managable.

-- JonL --