[comp.lang.scheme] why is quasiquote necessary?

alms@cambridge.apple.com (Andrew L. M. Shalit) (05/31/90)

It occurred to me today that Scheme doesn't really need a quasiquote
special form.  Instead, quote could have just been extended to handle
unquote and unquote-splicing.

I can only think of two reasons for having both quote and quasiquote:

 1) historical accident, because of the way the quasiquote special
    form was derived from a reader macro.
 2) program readability.  Some would argue that a large quoted piece of
    program text with a little bitty comma in the middle might be prone
    to misinterpretation (by humans).

   -andrew

kend@tekchips.LABS.TEK.COM (Ken Dickey) (05/31/90)

In article <ALMS.90May30153205@brazil.cambridge.apple.com> alms@cambridge.apple.com (Andrew L. M. Shalit) writes:
>
>It occurred to me today that Scheme doesn't really need a quasiquote
>special form.  Instead, quote could have just been extended to handle
>unquote and unquote-splicing.

Quoted data is constant [e.g. EPROMable].  My recollection is that
quasi-quoted forms may expand into something not quite constant.
I can't immediately think of a good example [nested quasi-quotes?]
{JAR, are you out there?}.

-Ken Dickey			kend@mrloog.WR.TEK.COM

dak@sq.sq.com (David A Keldsen) (06/01/90)

alms@cambridge.apple.com (Andrew L. M. Shalit) writes:

>It occurred to me today that Scheme doesn't really need a quasiquote
>special form.  Instead, quote could have just been extended to handle
>unquote and unquote-splicing.

>I can only think of two reasons for having both quote and quasiquote:

> 1) historical accident, because of the way the quasiquote special
>    form was derived from a reader macro.
> 2) program readability.  Some would argue that a large quoted piece of
>    program text with a little bitty comma in the middle might be prone
>    to misinterpretation (by humans).

I respectfully disagree [that Scheme doesn't need the quote-quasiquote
distinction].  This (IMHO) is one of those places where full generality
is *not* a good thing.  In particular, both human and machine readers
of quasiquoted phrases must scan the *entire* phrase, looking for
unquotes...which is an efficiency loss.  Quote allows one to say, "OK,
stop looking, the rest is unevaluated."  It's a common enough case that
it is worth the difference in notation.

>   -andrew
-- 
// David A. 'Dak' Keldsen:  dak@sq.com or utai[.toronto.edu]!sq!dak
// "I have heard the mermaids singing, each to each."  -- T.S.Eliot

mac@k9.cad.mcc.com (Mac Michaels) (06/01/90)

alms@cambridge.apple.com (Andrew L. M. Shalit) writes:

>It occurred to me today that Scheme doesn't really need a quasiquote
>special form.  Instead, quote could have just been extended to handle
>unquote and unquote-splicing.

>I can only think of two reasons for having both quote and quasiquote:

I always thought that quasiquote was there to allow Scheme code to generate
expressions that contain unquote and unquote-splicing symbols [, and ,@].
Quote does not process these symbols and thus allowing the generation of
forms containing them.
--
USPS: Mac Michaels,   3500 West Balcones Center Dr.,   Austin,TX 78759
ARPA: mac@mcc.com     TELE: (512) 338-3509         FAX: (512) 338-3600
UUCP: {uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!cadillac!mac 

  :-)))))))) She had so many chins, she looked like a piece of Lisp code!

gls@THINK.COM (Guy Steele) (06/02/90)

   From: "Andrew L. M. Shalit" <cambridge.apple.com!alms@bloom-beacon.mit.edu>
   To: scheme@mc.lcs.mit.edu

   It occurred to me today that Scheme doesn't really need a quasiquote
   special form.  Instead, quote could have just been extended to handle
   unquote and unquote-splicing.

   I can only think of two reasons for having both quote and quasiquote:

    1) historical accident, because of the way the quasiquote special
       form was derived from a reader macro.
    2) program readability.  Some would argue that a large quoted piece of
       program text with a little bitty comma in the middle might be prone
       to misinterpretation (by humans).

      -andrew

There are some effects that cannot be achieved using quasiquote
only.  Consider, for example, an idiom I find myself using
frequently:

		`',x

which means about the same as (list 'quote x).

		``,x

does not mean the same thing at all because the comma
is captured by the inner quasiquote.

--Guy

alan@AI.MIT.EDU (Alan Bawden) (06/02/90)

Unfortunately

  `',x

and

  '`,x

don't mean the same thing.