From: spoon
Subject: Backquote? Is this right?
Date: 
Message-ID: <2n1hfm$f2a@franklin.cc.utas.edu.au>
My third question to the net in a week, again, thanks to those that take the time to answer.  Today's prob - Is this right and if so why


CMU Common Lisp 17e, running on noether
Send bug reports and questions to your local CMU CL maintainer, or to
··········@cs.cmu.edu.
Loaded subsystems:
    Python 1.0, target SPARCstation/Sun 4
    CLOS based on PCL version:  September 16 92 PCL (f)
    CLX X Library MIT R5.01
    Motif toolkit and graphical debugger 1.0
    Hemlock 3.5
* (quote `(let ,b))

`(LET (COMMON-LISP::BACKQ-COMMA B)
   )
* (quote `(not-let ,b))

`(NOT-LET ,B)
*

Why does let expand differently? I thought backquote's behaviour would
be independent of this stuff.

Ta
Sp
--
*****************************************************************
*  Simon Wotherspoon                               _--_|\       *
*  Maths Dept, University of Tasmania             /  aus \      *
*  Tasmania, Australia                            \_.--._/      *
*  ·····@hilbert.maths.utas.edu.au        Here ->       v       *
*****************************************************************

From: spoon
Subject: Re: Backquote? Is this right?
Date: 
Message-ID: <2nd69o$nuk@franklin.cc.utas.edu.au>
In article <············@early-bird.think.com> ······@think.com (Barry Margolin) writes:
>In article <··········@franklin.cc.utas.edu.au> ·····@hilbert.maths.utas.edu.au (spoon) writes:
>>`(LET (COMMON-LISP::BACKQ-COMMA B)
>>   )
>>* (quote `(not-let ,b))
>>
>>`(NOT-LET ,B)
>>*
>>
>>Why does let expand differently? I thought backquote's behaviour would
>>be independent of this stuff.
>
>It's not expanding differently, it's only printing differently.  Many Lisp


After some thought, I figured this out.  The problem is, if you read
it back in, the reader doesn't convert it to a ",b", but reads back
`(LET (COMMON-LISP::BACKQ-COMMA B)), where the
(COMMON-LISP::BACKQ-COMMA B) doesn't behave like ,b. Surely this is
wrong?

Sp


--
*****************************************************************
*  Simon Wotherspoon                               _--_|\       *
*  Maths Dept, University of Tasmania             /  aus \      *
*  Tasmania, Australia                            \_.--._/      *
*  ·····@hilbert.maths.utas.edu.au        Here ->       v       *
*****************************************************************
From: Barry Margolin
Subject: Re: Backquote? Is this right?
Date: 
Message-ID: <2nm3iiINNql7@early-bird.think.com>
In article <··········@franklin.cc.utas.edu.au> ·····@hilbert.maths.utas.edu.au (spoon) writes:
>After some thought, I figured this out.  The problem is, if you read
>it back in, the reader doesn't convert it to a ",b", but reads back
>`(LET (COMMON-LISP::BACKQ-COMMA B)), where the
>(COMMON-LISP::BACKQ-COMMA B) doesn't behave like ,b. Surely this is
>wrong?

Yes, it does look like this is a bug.  There isn't really a call to
BACKQ-COMMA in the expansion of the read-macro.  If you set *PRINT-PRETTY*
to NIL you can see the actual expansion:

* (setq *print-pretty* nil)

NIL
* '`(let ,b)

(COMMON-LISP::BACKQ-LIST (QUOTE LET) B)
* '`(not-let ,b)

(COMMON-LISP::BACKQ-LIST (QUOTE NOT-LET) B)

I suspect COMMON-LISP::BACKQ-COMMA is an internal marker used by the CMUCL
pretty printer as it analyzes an expression.  Normally it gets displayed as
a comma, but it looks like the special case for pretty-printing LET forms
bypasses this and allows the marker to sneak out.

However, it's still the case that this only affects how the expression is
printed, and the expansion itself is correct.

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar