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

inconsistency in backquote spec?

    Date: Tue, 29 Nov 88 12:35:36 EST
    From: gls@Think.COM

       Date: Mon, 28 Nov 88 20:44 EST
       From: Michael Greenwald <Greenwald@stony-brook.scrc.symbolics.com>

       (setq d '(a . b))

       '`(,@d) => `(a . b) or `(a)?

       If you read CLtL, pg 350. it says that it's equivalent to
       `(,@d . nil)
       which is 
       (append [,@d] 'nil)
       (append d 'nil)
       which suggests the correct value is `(a).


       Are dotted lists not allowed as values of D?  Is the spec on pg 350
       correct, and the examples on pg. 351 incorrect?

       I tend to believe the latter.  In which case, all of the readers I tried
       are incorrect.  I'm not going to change the Genera reader, though, until
       I hear from this list, in case my brain is just wedged.  Can someone
       either deconfuse or support me?

    You raise some good points here.  At first I was certain that the book
    was not consistent, but now I have the following language lawyer's

    The spec for APPEND says that all arguments but the last must be lists.
    The comment about the last argument makes it clear that the others
    are meant to be proper lists; see also the middle paragraph of page 27.
    Therefore dotted lists are not allowed as values for D.

I thought a (recent?) CL Cleanup specified that if arguments (all but
the last) to APPEND (or NCONC) were dotted lists, the non-nil final CDR
was to be ignored.  In which case, the examples on 351 are incorrect.

Or, you could say that the list following a ,@ cannot be dotted.

Either way, I think, requires a minor clarification in the CL spec.

    The examples on page 351 are also correct.  Once you are given that
    D may not be dotted, and given that the result of a backquoted
    expression may or may not make copies, then the examples shown are
    correct optimizations.