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

BACKQUOTE



On [parc-maxc]<NETLISPUSERS>BQUOTE.COM (and <Lispusers>BQUOTE) is
a version of the "backquote" macro for Interlisp. 

This is similar to the facility of the same name in other
common lisp dialects as follows:

|'form is equivalent to 'form, except that, in the body
of form, an element preceded by a "," is evaluated, and
an element preceded by ",," is evaluated and spliced in.

For example, |'(A ,B ,,C D ,,E) is equivalent to
(CONS 'A (CONS B (APPEND C (CONS 'D E]

There are a couple of parts to the implementation:

| is given a read macro, such that |'form reads in
  as (BQUOTE form). (the readmacro is in T, FILERDTBL
  and EDITRDTBL). During the READing of form (but
  not outside a |' context), "," is given a read macro
  such that ,X reads in as (UNBQUOTE X).

BQUOTE has a macro property to expand out its argument
into the appropriate nest of CONSes and APPENDs, looking
for UNBQUOTEs.

BQUOTE has an entry on PRETTYPRINTMACROS so that BQUOTEd
expressions will prettyprint with |'.

Rational: |' has been implemented in such a way that it
doesn't conflict with the use of | as the "changechar";
since "|" has heretofor been a SEPR, this means that it
should be possible to enable BQUOTE and not worry about
files made without "|" preceeded by a "%".

The read macro doesn't expand the form into CONSes and
APPENDs because it is important that functions which
use backquote prettyprint reasonably.

Larry