Subject: Re: ILC2005: McCarthy denounces Common Lisp, "Lisp", XML, and Rahul
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 02 Jul 2005 02:56:13 -0500
Newsgroups: comp.lang.lisp
Message-ID: <w82dnZSDBb4A1VvfRVn-vQ@speakeasy.net>
Kent M Pitman  <pitman@nhplace.com> wrote:
+---------------
| rpw3@rpw3.org (Rob Warnock) writes:
| > I tend to prefer the Scheme-style default for the non-list arg case:
| >  (defmacro \\ (args &body body)
| >    `(lambda ,(if (listp args) args (list '&rest args)) ,@body))
| 
| Maybe you'd like
|   (defmacro \\ (args &body body)
|     `(lambda ,(do ((args args (cdr args))
|                    (temp '() (cons (car args) temp)))
|                   ((atom args)
|                (if (null args)      ; was it a proper list?
|                    (nreverse temp)  ; if so, just reverse saved args
|                    (nreconc temp    ; otherwise, reverse most and add tail:
|                             (list '&rest args)))))
|        ,@body))
| even better.
+---------------

Well, yes, if I were a Scheme purist, very probably.  ;-}

But once the arglist gets as big as (a b . rest) it's
not *that* much more trouble to go ahead and write out
(a b &rest rest). It's really "x" versus "(&rest x)"
that's the big convenience. IMHO. YMMV. Etc., &c.


-Rob

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