Kaz Kylheku <kkylheku@gmail.com> wrote:
+
 Rob Warnock <rpw3@rpw3.org> wrote:
 > Kaz Kylheku <kkylheku@gmail.com> wrote:
 > +
 > What if I want to annotate a cons which is constructed from two vectors?
 > `(#(,a ,b ,c) . #(,d ,e ,f))
 > Oops.
 > +
 >
 > What "oops"?
 > > (let ((a 1) (b 2) (c 3) (d 4) (e 5) (f 6))
 > `(#(,a ,b ,c) . #(,d ,e ,f)))
 > (#(1 2 3) . #(4 5 6))
 > >

 Good. The oops is that the spec doesn't require the above behavior.
 The form matches the case:

 `(x1 . atom) > (append [x1] (quote atom))

 Where x1 is #(,a ,b ,c) and atom is #(,d ,e ,f),
 and [x1] follows the [form] > (list `form) transformation.
 Hence the expansion is (append (list `#(,a b c)) (quote #(,d ,e ,f))
 which is nonsense with dangling commas.
+
Another possible interpretation  not in obvious direct contradiction
to CLHS 2.4.6 [if one allows nonconflicting extensions]  is that
there is a rule missing from CLHS 2.4.6:
`(x1 . x2) ==> (cons `x1 `x2)
which for your example would result in this expansion:
`(#(,a ,b ,c) . #(,d ,e ,f))) ==>
(cons `#(,a ,b ,c) `#(,d ,e ,f))) ==>
(cons (apply #'vector `(,a ,b ,c)) (apply #'vector `(,d ,e ,f))) ==>
(cons (apply #'vector (append (list a) (list b) (list c)))
(apply #'vector (append (list d) (list e) (list f))))
Rob
p.s. FWIW, the actual transformation implemented by CMUCL for the
same example is this:
`(#(,a ,b ,c) . #(,d ,e ,f))) ==>
(lisp::backqcons (lisp::backqvector (lisp::backqlist a b c))
(lisp::backqvector (lisp::backqlist d e f))) ==>
(cons (coerce (list a b c) 'simplevector)
(coerce (list d e f) 'simplevector))

Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)5722607