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

Re: moving on




On Dec 7, 2003, at 2:48 PM, Taylor Campbell wrote:

Comments, and what are some thoughts on whether to use (...) or (...
...) for the base of the ellipsis generator, which I mentioned in
passing a while ago?  (Argument for (...): it makes much more sense.
Argument for (... ...): it's what everyone uses already.)

Another idea: the ellipsis token is a dotted list whose elements are
all ... and whose terminator is ....  An empty dotted ellipsis list
acts as ellipsis; a dotted ellipsis list pair expands to its CDR.

Here's ALL-SYMBOLS as in the examples section using the dotted list
version, with the other two versions commented out nearby (the order
the lines using the different kinds is the order of my preference):

(define-syntax all-symbols
  (syntax-rules ()
    ((all-symbols (?car . ?cdr) ?k)
     (let-syntax
         ((k (syntax-rules ()
               ((k ?y* ?k*  (?symbol (... . ...))) ;dotted list
;              ((k ?y* ?k*  (?symbol (...)))       ;(...)     -> ...
;              ((k ?y* ?k*  (?symbol (... ...)))   ;(... ...) -> ...
                (let-syntax
                    ((k* (syntax-rules ()
                           ((k* ?k**
                                (?symbol* (... ... . ...)))
;                               (?symbol* (... ...)))
;                               (?symbol* (... ... ...)))
                            (union (?symbol  (... . ...))
;                           (union (?symbol  (...))
;                           (union (?symbol  (... ...))
                                   (?symbol* (... ... . ...)))))))
;                                  (?symbol* (... ...)))))))
;                                  (?symbol* (... ... ...)))))))
                  (all-symbols ?y* (k* ?k*)))))))
       (all-symbols ?x (k ?y ?k))))
    ((all-symbols #(?x ...) ?k)
     (all-symbols (?x ...) ?k))
    ((all-symbols ?x ?k)
     (syntax-symbol? ?x
       (apply-syntax-cont ?k (?x))
       (apply-syntax-cont ?k ())))))