From: Espen Vestre
Subject: backquote expansion in LW
Date: 
Message-ID: <kwsmzxw6gn.fsf@merced.netfonds.no>
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)

From: ilias
Subject: Re: backquote expansion in LW
Date: 
Message-ID: <amutrg$hnv$1@usenet.otenet.gr>
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:

why don't you post in topic, if you care about the newbies?

don't you realize that you behave like a troll?

> 
>  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

i'm a lisp novice.

function 'trace'

looks very nice.

i'll use it.

in the next document.

here the output of this function:

----------------------------------------------------------------------
CL-USER 1 >   (trace system::backquote-translate)
(SYSTEM::BACKQUOTE-TRANSLATE)
0 SYSTEM::BACKQUOTE-TRANSLATE > ((FOO #))
   >> SYSTEM::FORM : (FOO (SYSTEM::*BACKQUOTE-COMMA* BAR #))
   1 SYSTEM::BACKQUOTE-TRANSLATE > (FOO)
     >> SYSTEM::FORM : FOO
   1 SYSTEM::BACKQUOTE-TRANSLATE < (QUOTE FOO)
   1 SYSTEM::BACKQUOTE-TRANSLATE > ((#))
     >> SYSTEM::FORM : ((SYSTEM::*BACKQUOTE-COMMA* BAR #))
     2 SYSTEM::BACKQUOTE-TRANSLATE > ((SYSTEM::*BACKQUOTE-COMMA* BAR #))
       >> SYSTEM::FORM : (SYSTEM::*BACKQUOTE-COMMA* BAR 
(SYSTEM::*BACKQUOTE-COMMA* . GAZONK))
     2 SYSTEM::BACKQUOTE-TRANSLATE < (SYSTEM::*BACKQUOTE-COMMA* (BAR #))
     2 SYSTEM::BACKQUOTE-TRANSLATE > (NIL)
       >> SYSTEM::FORM : NIL
     2 SYSTEM::BACKQUOTE-TRANSLATE < (NIL NIL)
   1 SYSTEM::BACKQUOTE-TRANSLATE < (LIST (#))
0 SYSTEM::BACKQUOTE-TRANSLATE < (LIST (# #))
0 SYSTEM::BACKQUOTE-TRANSLATE > ((GAZONK #))
   >> SYSTEM::FORM : (GAZONK (SYSTEM::BQ-LIST # #))
   1 SYSTEM::BACKQUOTE-TRANSLATE > (GAZONK)
     >> SYSTEM::FORM : GAZONK
   1 SYSTEM::BACKQUOTE-TRANSLATE < (QUOTE GAZONK)
   1 SYSTEM::BACKQUOTE-TRANSLATE > ((#))
     >> SYSTEM::FORM : ((SYSTEM::BQ-LIST # #))
     2 SYSTEM::BACKQUOTE-TRANSLATE > ((SYSTEM::BQ-LIST # #))
       >> SYSTEM::FORM : (SYSTEM::BQ-LIST (QUOTE FOO) (BAR #))
       3 SYSTEM::BACKQUOTE-TRANSLATE > (SYSTEM::BQ-LIST)
         >> SYSTEM::FORM : SYSTEM::BQ-LIST
       3 SYSTEM::BACKQUOTE-TRANSLATE < (QUOTE SYSTEM::BQ-LIST)
       3 SYSTEM::BACKQUOTE-TRANSLATE > ((# #))
         >> SYSTEM::FORM : ((QUOTE FOO) (BAR #))
         4 SYSTEM::BACKQUOTE-TRANSLATE > ((QUOTE FOO))
           >> SYSTEM::FORM : (QUOTE FOO)
           5 SYSTEM::BACKQUOTE-TRANSLATE > (QUOTE)
             >> SYSTEM::FORM : QUOTE
           5 SYSTEM::BACKQUOTE-TRANSLATE < (QUOTE QUOTE)
           5 SYSTEM::BACKQUOTE-TRANSLATE > ((FOO))
             >> SYSTEM::FORM : (FOO)
             6 SYSTEM::BACKQUOTE-TRANSLATE > (FOO)
               >> SYSTEM::FORM : FOO
             6 SYSTEM::BACKQUOTE-TRANSLATE < (QUOTE FOO)
             6 SYSTEM::BACKQUOTE-TRANSLATE > (NIL)
               >> SYSTEM::FORM : NIL
             6 SYSTEM::BACKQUOTE-TRANSLATE < (NIL NIL)
           5 SYSTEM::BACKQUOTE-TRANSLATE < (QUOTE (FOO))
         4 SYSTEM::BACKQUOTE-TRANSLATE < (QUOTE (QUOTE FOO))
         4 SYSTEM::BACKQUOTE-TRANSLATE > ((#))
           >> SYSTEM::FORM : ((BAR #))
           5 SYSTEM::BACKQUOTE-TRANSLATE > ((BAR #))
             >> SYSTEM::FORM : (BAR (SYSTEM::*BACKQUOTE-COMMA* . GAZONK))
             6 SYSTEM::BACKQUOTE-TRANSLATE > (BAR)
               >> SYSTEM::FORM : BAR
             6 SYSTEM::BACKQUOTE-TRANSLATE < (QUOTE BAR)
             6 SYSTEM::BACKQUOTE-TRANSLATE > ((#))
               >> SYSTEM::FORM : ((SYSTEM::*BACKQUOTE-COMMA* . GAZONK))
               7 SYSTEM::BACKQUOTE-TRANSLATE > 
((SYSTEM::*BACKQUOTE-COMMA* . GAZONK))
                 >> SYSTEM::FORM : (SYSTEM::*BACKQUOTE-COMMA* . GAZONK)
               7 SYSTEM::BACKQUOTE-TRANSLATE < 
(SYSTEM::*BACKQUOTE-COMMA* GAZONK)
               7 SYSTEM::BACKQUOTE-TRANSLATE > (NIL)
                 >> SYSTEM::FORM : NIL
               7 SYSTEM::BACKQUOTE-TRANSLATE < (NIL NIL)
             6 SYSTEM::BACKQUOTE-TRANSLATE < (LIST (GAZONK))
           5 SYSTEM::BACKQUOTE-TRANSLATE < (LIST (# GAZONK))
           5 SYSTEM::BACKQUOTE-TRANSLATE > (NIL)
             >> SYSTEM::FORM : NIL
           5 SYSTEM::BACKQUOTE-TRANSLATE < (NIL NIL)
         4 SYSTEM::BACKQUOTE-TRANSLATE < (LIST (#))
       3 SYSTEM::BACKQUOTE-TRANSLATE < (LIST (# #))
     2 SYSTEM::BACKQUOTE-TRANSLATE < (LIST (# # #))
     2 SYSTEM::BACKQUOTE-TRANSLATE > (NIL)
       >> SYSTEM::FORM : NIL
     2 SYSTEM::BACKQUOTE-TRANSLATE < (NIL NIL)
   1 SYSTEM::BACKQUOTE-TRANSLATE < (LIST (#))
0 SYSTEM::BACKQUOTE-TRANSLATE < (LIST (# #))

CL-USER 2 >   '`(gazonk `(foo ,(bar ,gazonk)))
(SYSTEM::BQ-LIST (QUOTE GAZONK) (SYSTEM::BQ-LIST (QUOTE SYSTEM::BQ-LIST) 
(QUOTE (QUOTE FOO)) (SYSTEM::BQ-LIST (QUOTE BAR) GAZONK)))

CL-USER 3 >
From: ilias
Subject: Re: backquote expansion in LW
Date: 
Message-ID: <amvt8e$fah$1@usenet.otenet.gr>
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.
From: ilias
Subject: Re: backquote expansion in LW
Date: 
Message-ID: <an2225$5jm$1@usenet.otenet.gr>
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.