Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
backquote expansion in LW
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Espen Vestre  
View profile  
 More options Sep 26 2002, 3:33 am
Newsgroups: comp.lang.lisp
From: Espen Vestre <espen@*do-not-spam-me*.vestre.net>
Date: Thu, 26 Sep 2002 07:33:33 GMT
Local: Thurs, Sep 26 2002 3:33 am
Subject: backquote expansion in LW
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)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ilias  
View profile  
 More options Sep 26 2002, 8:19 am
Newsgroups: comp.lang.lisp
From: ilias <at_n...@pontos.net>
Date: Thu, 26 Sep 2002 15:25:35 +0300
Local: Thurs, Sep 26 2002 8:25 am
Subject: Re: backquote expansion in LW

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 >


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ilias  
View profile  
 More options Sep 26 2002, 5:13 pm
Newsgroups: comp.lang.lisp
From: ilias <at_n...@pontos.net>
Date: Fri, 27 Sep 2002 00:21:27 +0300
Local: Thurs, Sep 26 2002 5:21 pm
Subject: Re: backquote expansion in LW

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ilias  
View profile  
 More options Sep 27 2002, 12:47 pm
Newsgroups: comp.lang.lisp
From: ilias <at_n...@pontos.net>
Date: Fri, 27 Sep 2002 19:55:52 +0300
Local: Fri, Sep 27 2002 12:55 pm
Subject: Re: backquote expansion in LW

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.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »