Subject: [clisp-list] Re: New, from-scratch implementation of backquote.

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Wed Mar 26 05:38:11 2003

Hi,

please help me nuderstand some area of backquotes.

Kaz Kylheku wrote:
>Which reminds me that I should add some optimization for reducing
>a constant list to a constant vector; we should be spitting out
>the literal object:
>  #(1 2 (2 3) 3)
Yes please:
`(foo #(1 2 3) ,bar)
should not call (vector 1 2 3) at run-time.
Or at least I believe so.
(list 'foo '#(1 2 3) bar) is the code I'd expect.

[...]
>   (list 'system::backquote (vector 1 
>                                    (list 'system::unquote 'a) 
>                                    2))
>   ==> `#(1 ,A 2)
>This is a feature: we want the backquote notation to have a
>list-based target language such that we can write code which writes
>that language.

This is great! Actually, I believe I posted several years ago to comp.lang.lisp on the topic of standardizing backquote internals (like in Scheme). I now believe that this not possible in CL (your e-mails here helped). But it's fine if it works in CLISP.

Regards,
	Jorg Hohle.

---

From: Kaz Kylheku <[email-masked]>
Date: Wed Mar 26 08:40:04 2003

> Yes please:

Thanks for the second reminder. I now put this simple change in.

[9]> (macroexpand-1 '`#(1 2 ,@(list 10 20) 3))
#(1 2 10 20 3) ;
T
[10]> (macroexpand-1 '`#(1 2 ,@(list a 20) 3))
(APPLY #'VECTOR (LIST 1 2 A 20 3)) ;
T

> (list 'foo '#(1 2 3) bar) is the code I'd expect.

[11]> (macroexpand '`(foo #(1 2 3) ,bar))
(LIST 'FOO #(1 2 3) BAR) ;
T

[12]> (macroexpand '`(foo #(1 ,x 3) ,bar))
(LIST 'FOO (APPLY #'VECTOR (LIST 1 X 3)) BAR) ;
T

[13]> (macroexpand '`(foo #(1 2 3) bar))
'(FOO #(1 2 3) BAR) ;
T