I might be feeding the trolls (*), but I couldn't resist posting a
little discovery I just made, and I think newbies that get confused
by certain postings on backquote may find this very helpful:
In LispWorks(**), the backquote expansion of nested backquotes is
done _exactly_ in the order of the definition in the spec, and it's
possible to trace it!
You can do this little experiment at home:
(trace system::backquote-translate)
'`(gazonk `(foo ,(bar ,gazonk)))
(*) Troll follow-ups will be redirected to /dev/null (I promise!) ;-)
(**) tested on LW 4.2.6 linux + win32
--
(espen)
Espen Vestre wrote:
> I might be feeding the trolls (*), but I couldn't resist posting a
> little discovery I just made, and I think newbies that get confused
> by certain postings on backquote may find this very helpful:
>
> In LispWorks(**), the backquote expansion of nested backquotes is
> done _exactly_ in the order of the definition in the spec, and it's
> possible to trace it!
>
> You can do this little experiment at home:
>
> (trace system::backquote-translate)
> '`(gazonk `(foo ,(bar ,gazonk)))
>
> (*) Troll follow-ups will be redirected to /dev/null (I promise!) ;-)
> (**) tested on LW 4.2.6 linux + win32
well, i've played a little with this.
and i'm now *really* confused.
why do you give me the best argument, that the definition of backquote
is wrong?
anyway.
Espen Vestre wrote:
> I might be feeding the trolls (*), but I couldn't resist posting a
> little discovery I just made, and I think newbies that get confused
> by certain postings on backquote may find this very helpful:
>
> In LispWorks(**), the backquote expansion of nested backquotes is
> done _exactly_ in the order of the definition in the spec, and it's
> possible to trace it!
>
> You can do this little experiment at home:
>
> (trace system::backquote-translate)
> '`(gazonk `(foo ,(bar ,gazonk)))
>
> (*) Troll follow-ups will be redirected to /dev/null (I promise!) ;-)
> (**) tested on LW 4.2.6 linux + win32
now what you've provided is irrelevant.
it describes internal implementation-dependent processing.
the specs state 'expanded', expansion referes to replacing ` with the
implementation-dependent function and , with the
implementation-dependent function(s), thus creating the evaluateable
representation of the input-string.
in LispWorks:
CL-USER 1 > (get-macro-character #\`)
SYSTEM::READ-BACKQUOTE
NIL
thus you should simply trace this:
(trace System::read-backquote)
test expression:
`(,a `(,,b))
and the you got what's obvious:
(i've abbreviated some text, so the lines fit in one line.
0 SYSTEM::READ-BACKQUOTE > (#<E::RS #<EDITOR... i-pane 2>> #\`)
>> STREAM : #<E::RS #<EDITOR... i-pane 2>>
>> CHAR : #\`
1 SYSTEM::READ-BACKQUOTE > (#<E::RS #<EDITOR... i-pane 2>> #\`)
>> STREAM : ##<E::RS #<EDITOR... i-pane 2>>
>> CHAR : #\`
1 SYSTEM::READ-BACKQUOTE < ((SYSTEM::BQ-LIST #))
0 SYSTEM::READ-BACKQUOTE < ((SYSTEM::BQ-LIST A #))
CL-USER 7 > `(,a `(,,b))
| |
0-----------+ |
1--------------+
outermost backquote is expanded first.
thus: specs paragraph 'nested backquote' wrong.