From: ·············@gmail.com
Subject: rest vs. body
Date: 
Message-ID: <8e42c2d6-5e65-4ffd-9648-c3f1c60f9989@x35g2000hsb.googlegroups.com>
I was reading peter seibel's lisp book and run into such variable
declarations in a macro.

(defmacro with-gensyms ((&rest names) &body body)
  `(let ,(loop for n in names collect `(,n (gensym)))
     ,@body))

why did he put parenthesis around the '&rest names' i checked it in
slime both with and without parenthesis and i always get the same
results. so what was this for?

thanks .

From: Thomas A. Russ
Subject: Re: rest vs. body
Date: 
Message-ID: <ymi7icl5p3q.fsf@blackcat.isi.edu>
·············@gmail.com writes:

> I was reading peter seibel's lisp book and run into such variable
> declarations in a macro.
> 
> (defmacro with-gensyms ((&rest names) &body body)
>   `(let ,(loop for n in names collect `(,n (gensym)))
>      ,@body))
> 
> why did he put parenthesis around the '&rest names'

To make it clear what sort of argument pattern is expected.  With a
simple name in that position, you have to make sure you read the
documentation that comes with the macro to see that a list is required.

There is also a documentation issue (and some support from
pretty-printing and indentation software) around the difference between
&rest and &body as well.  The idea is that &body is used to indicate
blocks of code that are usually just included verbatim in the macro
expansion.

>  i checked it in
> slime both with and without parenthesis and i always get the same
> results. so what was this for?

It actually gets more interesting if you have have some required
parameters, since the whole set of lambda options become available to
you as well.

So, for example, if one wanted to write a scheme-like defun substitute:

(defmacro define-function ((name &rest variables) &body body)
  `(defun ,name ,variables ,@body))

you then have some destructuring that also takes place when you invoke
it something like:

(define-function (fact n)
    (if (< n 2) 1 (* n (fact (1- n)))))

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: John Thingstad
Subject: Re: rest vs. body
Date: 
Message-ID: <op.uc0ra2t8ut4oq5@pandora.alfanett.no>
P� Thu, 19 Jun 2008 19:08:57 +0200, skrev Thomas A. Russ  
<···@sevak.isi.edu>:

> ·············@gmail.com writes:
>
>> I was reading peter seibel's lisp book and run into such variable
>> declarations in a macro.
>>
>> (defmacro with-gensyms ((&rest names) &body body)
>>   `(let ,(loop for n in names collect `(,n (gensym)))
>>      ,@body))
>>
>> why did he put parenthesis around the '&rest names'
>
> To make it clear what sort of argument pattern is expected.  With a
> simple name in that position, you have to make sure you read the
> documentation that comes with the macro to see that a list is required.
>
> There is also a documentation issue (and some support from
> pretty-printing and indentation software) around the difference between
> &rest and &body as well.  The idea is that &body is used to indicate
> blocks of code that are usually just included verbatim in the macro
> expansion.
>
>>  i checked it in
>> slime both with and without parenthesis and i always get the same
>> results. so what was this for?
>
> It actually gets more interesting if you have have some required
> parameters, since the whole set of lambda options become available to
> you as well.
>
> So, for example, if one wanted to write a scheme-like defun substitute:
>
> (defmacro define-function ((name &rest variables) &body body)
>   `(defun ,name ,variables ,@body))
>
> you then have some destructuring that also takes place when you invoke
> it something like:
>
> (define-function (fact n)
>     (if (< n 2) 1 (* n (fact (1- n)))))
>

I prefer with-unique-names and rebinding to with-gensyms and once-only.
They are a part of the LispWorks package.

--------------
John Thingstad
From: Kaz Kylheku
Subject: Re: rest vs. body
Date: 
Message-ID: <cc282543-1d78-4e41-90f7-49930b72a1aa@j1g2000prb.googlegroups.com>
On Jun 19, 4:13 am, ·············@gmail.com wrote:
> I was reading peter seibel's lisp book and run into such variable
> declarations in a macro.
>
> (defmacro with-gensyms ((&rest names) &body body)
>   `(let ,(loop for n in names collect `(,n (gensym)))
>      ,@body))
>
> why did he put parenthesis around the '&rest names'

This ie because it is a ``destructuring lambda list''.  The lambda
list of a macro is called a macro lambda list, and it has the special
property that it can contain nested lambda lists called destructuring
lambda list.

The entire (&rest names) lambda list behaves as a single parameter in
the outer macro lambda list; it matches a single argument of the
macro. That argument is treated as a miniature argument list which is
matched against the (&rest names) syntax.

So for instance if the arguments are ((A B C) D E) then NAMES will be
(A B C) and BODY will be (D E).  The syntax (A B C) in the first
position is matched against (&REST NAMES).

So if NAMES simply takes on the first argument (A B C) why not just
specify it as (NAMES &REST BODY)?

Writing it this way does not clarify that what is expected in the
first argument position is a (possibly empty) list of forms. Only from
the pluralization of the identifier NAMES can you guess that a list is
probably expected.

I suspect that there is also a real difference between:

  (names &body body)

and

  ((&rest names) &body body)

In the former, the destructuring match allows for anything to match
NAMES. But, I think that in the latter, NAMES must be a list: a cons
or the atom NIL. An improper list (one terminated by an atom other
than NIL) may match &REST, but a single atom is not considered an
improper list.

The Lisp I'm using doesn't diagnose this: I can call the above macro
using (1 2 3). No error is signaled, and NAMES takes on the value 1.
Even if I define a macro like this (DEFMACRO FOO (&REST BAR)) I can
call (FOO 1), and BAR just takes on 1. Still, I have the impression
from reading the CLHS about macro lambda lists that this isn't right.
(Someone correct me if I'm wrong).

> i checked it in
> slime both with and without parenthesis and i always get the same
> results. so what was this for?

The syntax (&rest names &body body) is simply invalid, as others have
pointed out. Only one of &REST and &BODY  may appear in a lambda list
(or in the same macro or destructuring lambda list at the same level
of nesting).
From: Thomas A. Russ
Subject: Re: rest vs. body
Date: 
Message-ID: <ymiej6s6qds.fsf@blackcat.isi.edu>
Kaz Kylheku <········@gmail.com> writes:
> Even if I define a macro like this (DEFMACRO FOO (&REST BAR)) I can
> call (FOO 1), and BAR just takes on 1. Still, I have the impression
> from reading the CLHS about macro lambda lists that this isn't right.
> (Someone correct me if I'm wrong).

You are right that the behavior you describe is not correct.  The value
of BAR should be (1) instead of 1



CL-USER> (defmacro foo (&rest bar) `',(print bar))
FOO
CL-USER> (foo 1)

(1) 
(1)
CL-USER> (foo 1 2 3)

(1 2 3) 
(1 2 3)

-- 
Thomas A. Russ,  USC/Information Sciences Institute
From: Rainer Joswig
Subject: Re: rest vs. body
Date: 
Message-ID: <joswig-6751CF.13354619062008@news-europe.giganews.com>
In article 
<····································@x35g2000hsb.googlegroups.com>,
 ·············@gmail.com wrote:

> I was reading peter seibel's lisp book and run into such variable
> declarations in a macro.
> 
> (defmacro with-gensyms ((&rest names) &body body)
>   `(let ,(loop for n in names collect `(,n (gensym)))
>      ,@body))
> 
> why did he put parenthesis around the '&rest names' i checked it in
> slime both with and without parenthesis and i always get the same
> results. so what was this for?
> 
> thanks .


(defun foo (&rest names &body body)

  ...)

is not allowed in ANSI CL. There can be only one of &body or
&rest at one level. A good CL implementation will complain.

HyperSpec: 'Only one of &body or &rest can be used at any particular level; '



(defun foo1 ((&rest names) &body body)

  ...)


indicates that names would be a list of names and body
would be a list of code expressions. Like in:

(foo1 (name-1 name-2 name-n)
  (do-something name-1)
  (do-something name-2)
  (do-something name-n))

If you use &body or &rest is mostly a style issue.
With &body you indicate that the variable following
will be bound to some code expressions and this
helps indenting.

(defun foo2 ((&rest names) &rest body)

  ...)

Then we would write and indent:


(foo2 (name-1 name-2 name-n)
      (do-something name-1)
      (do-something name-2)
      (do-something name-n))

-- 
http://lispm.dyndns.org/
From: ·············@gmail.com
Subject: Re: rest vs. body
Date: 
Message-ID: <e3792c4a-efab-4e8e-9589-2fad641c20a6@w7g2000hsa.googlegroups.com>
On Jun 19, 2:35 pm, Rainer Joswig <······@lisp.de> wrote:
> In article
> <····································@x35g2000hsb.googlegroups.com>,
>
>  ·············@gmail.com wrote:
> > I was reading peter seibel's lisp book and run into such variable
> > declarations in a macro.
>
> > (defmacro with-gensyms ((&rest names) &body body)
> >   `(let ,(loop for n in names collect `(,n (gensym)))
> >      ,@body))
>
> > why did he put parenthesis around the '&rest names' i checked it in
> > slime both with and without parenthesis and i always get the same
> > results. so what was this for?
>
> > thanks .
>
> (defun foo (&rest names &body body)
>
>   ...)
>
> is not allowed in ANSI CL. There can be only one of &body or
> &rest at one level. A good CL implementation will complain.
>
> HyperSpec: 'Only one of &body or &rest can be used at any particular level; '
>
> (defun foo1 ((&rest names) &body body)
>
>   ...)
>
> indicates that names would be a list of names and body
> would be a list of code expressions. Like in:
>
> (foo1 (name-1 name-2 name-n)
>   (do-something name-1)
>   (do-something name-2)
>   (do-something name-n))
>
> If you use &body or &rest is mostly a style issue.
> With &body you indicate that the variable following
> will be bound to some code expressions and this
> helps indenting.
>
> (defun foo2 ((&rest names) &rest body)
>
>   ...)
>
> Then we would write and indent:
>
> (foo2 (name-1 name-2 name-n)
>       (do-something name-1)
>       (do-something name-2)
>       (do-something name-n))
>
> --http://lispm.dyndns.org/

HI thanks for the answer, I was visition your site yesterday; nice
coincidence :)

I can't define functions in Slime as you showed

(defun foo2 ((&rest names) &rest body)

I take such an error:

FUNCTION: (&REST REST) is not a SYMBOL

so, I think that type of decleration is correct only for macros. but
the point i don't get is that why shouldn't i define above functions

(defmacro foo2 (names &rest body)

instead of:ambigious one:

(defun foo2 ((&rest names) &rest body)

I always get the same results. so, is  `indenting` the only reason of
preferring the latter style?-which won't work in Slime anyway :S
From: Rainer Joswig
Subject: Re: rest vs. body
Date: 
Message-ID: <joswig-2B318B.14084219062008@news-europe.giganews.com>
In article 
<····································@w7g2000hsa.googlegroups.com>,
 ·············@gmail.com wrote:

> On Jun 19, 2:35 pm, Rainer Joswig <······@lisp.de> wrote:
> > In article
> > <····································@x35g2000hsb.googlegroups.com>,
> >
> >  ·············@gmail.com wrote:
> > > I was reading peter seibel's lisp book and run into such variable
> > > declarations in a macro.
> >
> > > (defmacro with-gensyms ((&rest names) &body body)
> > >   `(let ,(loop for n in names collect `(,n (gensym)))
> > >      ,@body))
> >
> > > why did he put parenthesis around the '&rest names' i checked it in
> > > slime both with and without parenthesis and i always get the same
> > > results. so what was this for?
> >
> > > thanks .
> >
> > (defun foo (&rest names &body body)
> >
> >   ...)
> >
> > is not allowed in ANSI CL. There can be only one of &body or
> > &rest at one level. A good CL implementation will complain.
> >
> > HyperSpec: 'Only one of &body or &rest can be used at any particular level; '
> >
> > (defun foo1 ((&rest names) &body body)
> >
> >   ...)
> >
> > indicates that names would be a list of names and body
> > would be a list of code expressions. Like in:
> >
> > (foo1 (name-1 name-2 name-n)
> >   (do-something name-1)
> >   (do-something name-2)
> >   (do-something name-n))
> >
> > If you use &body or &rest is mostly a style issue.
> > With &body you indicate that the variable following
> > will be bound to some code expressions and this
> > helps indenting.
> >
> > (defun foo2 ((&rest names) &rest body)
> >
> >   ...)

Oops, did I write DEFUN? I meant DEFMACRO.


> >
> > Then we would write and indent:
> >
> > (foo2 (name-1 name-2 name-n)
> >       (do-something name-1)
> >       (do-something name-2)
> >       (do-something name-n))
> >
> > --http://lispm.dyndns.org/
> 
> HI thanks for the answer, I was visition your site yesterday; nice
> coincidence :)
> 
> I can't define functions in Slime as you showed
> 
> (defun foo2 ((&rest names) &rest body)
> 
> I take such an error:
> 
> FUNCTION: (&REST REST) is not a SYMBOL

See above, I meant DEFMACRO.

> 
> so, I think that type of decleration is correct only for macros. but
> the point i don't get is that why shouldn't i define above functions
> 
> (defmacro foo2 (names &rest body)
> 
> instead of:ambigious one:
> 
> (defun foo2 ((&rest names) &rest body)
> 
> I always get the same results. so, is  `indenting` the only reason of
> preferring the latter style?-which won't work in Slime anyway :S

(defmacro foo2 (names &rest body)
 ...)

vs.

(defmacro foo3 ((&rest names) &rest body) ...)

In this case names is required to be a list (possibly empty).


You can't write:  (foo3 a b c d)

* (macroexpand '(foo3 a b c d))

debugger invoked on a SB-KERNEL::DEFMACRO-BOGUS-SUBLIST-ERROR:
  error while parsing arguments to DEFMACRO FOO3:
    bogus sublist A to satisfy lambda-list (&REST NAMES)

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

((DEFMACRO FOO3) (FOO3 A B C D) #<unavailable argument>)
0]

-- 
http://lispm.dyndns.org/
From: ·············@gmail.com
Subject: Re: rest vs. body
Date: 
Message-ID: <2d8963c6-2ef3-4b50-8511-c814f720a099@z72g2000hsb.googlegroups.com>
On Jun 19, 3:08 pm, Rainer Joswig <······@lisp.de> wrote:
> In article
> <····································@w7g2000hsa.googlegroups.com>,
>
>
>
>  ·············@gmail.com wrote:
> > On Jun 19, 2:35 pm, Rainer Joswig <······@lisp.de> wrote:
> > > In article
> > > <····································@x35g2000hsb.googlegroups.com>,
>
> > >  ·············@gmail.com wrote:
> > > > I was reading peter seibel's lisp book and run into such variable
> > > > declarations in a macro.
>
> > > > (defmacro with-gensyms ((&rest names) &body body)
> > > >   `(let ,(loop for n in names collect `(,n (gensym)))
> > > >      ,@body))
>
> > > > why did he put parenthesis around the '&rest names' i checked it in
> > > > slime both with and without parenthesis and i always get the same
> > > > results. so what was this for?
>
> > > > thanks .
>
> > > (defun foo (&rest names &body body)
>
> > >   ...)
>
> > > is not allowed in ANSI CL. There can be only one of &body or
> > > &rest at one level. A good CL implementation will complain.
>
> > > HyperSpec: 'Only one of &body or &rest can be used at any particular level; '
>
> > > (defun foo1 ((&rest names) &body body)
>
> > >   ...)
>
> > > indicates that names would be a list of names and body
> > > would be a list of code expressions. Like in:
>
> > > (foo1 (name-1 name-2 name-n)
> > >   (do-something name-1)
> > >   (do-something name-2)
> > >   (do-something name-n))
>
> > > If you use &body or &rest is mostly a style issue.
> > > With &body you indicate that the variable following
> > > will be bound to some code expressions and this
> > > helps indenting.
>
> > > (defun foo2 ((&rest names) &rest body)
>
> > >   ...)
>
> Oops, did I write DEFUN? I meant DEFMACRO.
>
>
>
>
>
> > > Then we would write and indent:
>
> > > (foo2 (name-1 name-2 name-n)
> > >       (do-something name-1)
> > >       (do-something name-2)
> > >       (do-something name-n))
>
> > > --http://lispm.dyndns.org/
>
> > HI thanks for the answer, I was visition your site yesterday; nice
> > coincidence :)
>
> > I can't define functions in Slime as you showed
>
> > (defun foo2 ((&rest names) &rest body)
>
> > I take such an error:
>
> > FUNCTION: (&REST REST) is not a SYMBOL
>
> See above, I meant DEFMACRO.
>
>
>
> > so, I think that type of decleration is correct only for macros. but
> > the point i don't get is that why shouldn't i define above functions
>
> > (defmacro foo2 (names &rest body)
>
> > instead of:ambigious one:
>
> > (defun foo2 ((&rest names) &rest body)
>
> > I always get the same results. so, is  `indenting` the only reason of
> > preferring the latter style?-which won't work in Slime anyway :S
>
> (defmacro foo2 (names &rest body)
>  ...)
>
> vs.
>
> (defmacro foo3 ((&rest names) &rest body) ...)
>
> In this case names is required to be a list (possibly empty).
>
> You can't write:  (foo3 a b c d)
>
> * (macroexpand '(foo3 a b c d))
>
> debugger invoked on a SB-KERNEL::DEFMACRO-BOGUS-SUBLIST-ERROR:
>   error while parsing arguments to DEFMACRO FOO3:
>     bogus sublist A to satisfy lambda-list (&REST NAMES)
>
> Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
>
> restarts (invokable by number or by possibly-abbreviated name):
>   0: [ABORT] Exit debugger, returning to top level.
>
> ((DEFMACRO FOO3) (FOO3 A B C D) #<unavailable argument>)
> 0]
>
> --http://lispm.dyndns.org/

correction, i meant (defun foo2 ((&rest names) &body body)  not (defun
foo2 ((&rest names) &rest body) which i wrote in my previous post.

> (defmacro foo3 ((&rest names) &rest body) ...)
>
> In this case names is required to be a list (possibly empty).

no It doesn't have to according to Slime; here are the results:

CL-USER> (defmacro mac( (&rest rest) &body body)
           (print (cons rest 'a))
           (print body))
MAC

CL-USER> (defmacro mac2( rest &body body)
           (print (cons rest 'a))
           (print body))
MAC2



now let's compare the functions:
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CL-USER> (mac2 (1 2) + 3 4 5 6 )

((1 2) . A)
(+ 3 4 5 6)
18
CL-USER> (mac (1 2) + 3 4 5 6 )

((1 2) . A)
(+ 3 4 5 6)
18

SAME results
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CL-USER> (mac 1  + 3 4 5 6 )

(1 . A)
(+ 3 4 5 6)
18
CL-USER> (mac2 1  + 3 4 5 6 )

(1 . A)
(+ 3 4 5 6)
18
again SAME results
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CL-USER> (mac 1 2  + 3 4 5 6 )

(1 . A)
(2 + 3 4 5 6)
; Evaluation aborted

CL-USER> (mac2 1 2  + 3 4 5 6 )

(1 . A)
(2 + 3 4 5 6)
; Evaluation aborted

again SAME results, which require "2" to be function but it is not.
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
so, why should I prefer this (defmacro mac( (&rest rest) &body
body)  ? :S

ps: i might sound to be hard to learn but I really wonder the reasons,
why? thanks for your effort btw.
From: Rainer Joswig
Subject: Re: rest vs. body
Date: 
Message-ID: <joswig-258810.14423119062008@news-europe.giganews.com>
In article 
<····································@z72g2000hsb.googlegroups.com>,
 ·············@gmail.com wrote:

> > (defmacro foo3 ((&rest names) &rest body) ...)
> >
> > In this case names is required to be a list (possibly empty).
> 
> no It doesn't have to according to Slime; here are the results:

SLIME is just an editor interface.

> 
> CL-USER> (defmacro mac( (&rest rest) &body body)
>            (print (cons rest 'a))
>            (print body))
> MAC
> 
> CL-USER> (defmacro mac2( rest &body body)
>            (print (cons rest 'a))
>            (print body))
> MAC2
> 
> 
> 
> now let's compare the functions:
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> CL-USER> (mac2 (1 2) + 3 4 5 6 )
> 
> ((1 2) . A)
> (+ 3 4 5 6)
> 18
> CL-USER> (mac (1 2) + 3 4 5 6 )
> 
> ((1 2) . A)
> (+ 3 4 5 6)
> 18
> 
> SAME results
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> CL-USER> (mac 1  + 3 4 5 6 )
> 
> (1 . A)
> (+ 3 4 5 6)
> 18

Which Common Lisp are you using?

SBCL says:


* (defmacro mac ((&rest rest) &body body)
  (print (cons rest 'a))
  (print body))

MAC
* (mac 1  + 3 4 5 6 )

debugger invoked on a SB-KERNEL::DEFMACRO-BOGUS-SUBLIST-ERROR:
  error while parsing arguments to DEFMACRO MAC:
    bogus sublist 1 to satisfy lambda-list (&REST REST)

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

((DEFMACRO MAC) (MAC 1 + 3 4 5 6) #<unavailable argument>)
0] 


(&rest rest) demands that there is a list. But there isn't.


You have detected that some Lisp implementation might not catch that error.
You might want to complain to your 'vendor'.



> CL-USER> (mac2 1  + 3 4 5 6 )
> 
> (1 . A)
> (+ 3 4 5 6)
> 18
> again SAME results
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> CL-USER> (mac 1 2  + 3 4 5 6 )
> 
> (1 . A)
> (2 + 3 4 5 6)
> ; Evaluation aborted
> 
> CL-USER> (mac2 1 2  + 3 4 5 6 )
> 
> (1 . A)
> (2 + 3 4 5 6)
> ; Evaluation aborted
> 
> again SAME results, which require "2" to be function but it is not.
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> so, why should I prefer this (defmacro mac( (&rest rest) &body
> body)  ? :S
> 
> ps: i might sound to be hard to learn but I really wonder the reasons,
> why? thanks for your effort btw.

-- 
http://lispm.dyndns.org/
From: ·············@gmail.com
Subject: Re: rest vs. body
Date: 
Message-ID: <9fff7434-95ab-4436-ab64-b3761344bce6@f36g2000hsa.googlegroups.com>
On Jun 19, 3:42 pm, Rainer Joswig <······@lisp.de> wrote:
> In article
> <····································@z72g2000hsb.googlegroups.com>,
>
>  ·············@gmail.com wrote:
> > > (defmacro foo3 ((&rest names) &rest body) ...)
>
> > > In this case names is required to be a list (possibly empty).
>
> > no It doesn't have to according to Slime; here are the results:
>
> SLIME is just an editor interface.
>
>
>
>
>
> > CL-USER> (defmacro mac( (&rest rest) &body body)
> >            (print (cons rest 'a))
> >            (print body))
> > MAC
>
> > CL-USER> (defmacro mac2( rest &body body)
> >            (print (cons rest 'a))
> >            (print body))
> > MAC2
>
> > now let's compare the functions:
> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > CL-USER> (mac2 (1 2) + 3 4 5 6 )
>
> > ((1 2) . A)
> > (+ 3 4 5 6)
> > 18
> > CL-USER> (mac (1 2) + 3 4 5 6 )
>
> > ((1 2) . A)
> > (+ 3 4 5 6)
> > 18
>
> > SAME results
> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > CL-USER> (mac 1  + 3 4 5 6 )
>
> > (1 . A)
> > (+ 3 4 5 6)
> > 18
>
> Which Common Lisp are you using?
>
> SBCL says:
>
> * (defmacro mac ((&rest rest) &body body)
>   (print (cons rest 'a))
>   (print body))
>
> MAC
> * (mac 1  + 3 4 5 6 )
>
> debugger invoked on a SB-KERNEL::DEFMACRO-BOGUS-SUBLIST-ERROR:
>   error while parsing arguments to DEFMACRO MAC:
>     bogus sublist 1 to satisfy lambda-list (&REST REST)
>
> Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
>
> restarts (invokable by number or by possibly-abbreviated name):
>   0: [ABORT] Exit debugger, returning to top level.
>
> ((DEFMACRO MAC) (MAC 1 + 3 4 5 6) #<unavailable argument>)
> 0]
>
> (&rest rest) demands that there is a list. But there isn't.
>
> You have detected that some Lisp implementation might not catch that error.
> You might want to complain to your 'vendor'.
>
>
>
> > CL-USER> (mac2 1  + 3 4 5 6 )
>
> > (1 . A)
> > (+ 3 4 5 6)
> > 18
> > again SAME results
> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > CL-USER> (mac 1 2  + 3 4 5 6 )
>
> > (1 . A)
> > (2 + 3 4 5 6)
> > ; Evaluation aborted
>
> > CL-USER> (mac2 1 2  + 3 4 5 6 )
>
> > (1 . A)
> > (2 + 3 4 5 6)
> > ; Evaluation aborted
>
> > again SAME results, which require "2" to be function but it is not.
> > ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> > so, why should I prefer this (defmacro mac( (&rest rest) &body
> > body)  ? :S
>
> > ps: i might sound to be hard to learn but I really wonder the reasons,
> > why? thanks for your effort btw.
>
> --http://lispm.dyndns.org/

yeah, I was expecting it to require parenthesis as you said, but It
didn't :S

I am using Lisp in a Box. regarding excerpt from the book:

"
In this chapter you’ll set up your programming environment and write
your first Common Lisp programs. We’ll use the easy-to-install Lisp in
a Box developed by Matthew Danish and Mikel Evins, which packages a
Common Lisp implementation with Emacs, a powerful Lisp-aware text
editor, and SLIME,[1] a Common Lisp development environment built on
top of Emacs.
"

I might want to inform the vendor but I have spent last 3 hours of
mine by searching a meaningful description for that, so I am kinda
annoyed now :S . anyway dude, thanks for your concern and messages.
regards :))
From: Rainer Joswig
Subject: Re: rest vs. body
Date: 
Message-ID: <joswig-26C9E0.14572019062008@news-europe.giganews.com>
In article 
<····································@f36g2000hsa.googlegroups.com>,
 ·············@gmail.com wrote:

> yeah, I was expecting it to require parenthesis as you said, but It
> didn't :S
> 
> I am using Lisp in a Box. regarding excerpt from the book:
> 
> "
> In this chapter you�ll set up your programming environment and write
> your first Common Lisp programs. We�ll use the easy-to-install Lisp in
> a Box developed by Matthew Danish and Mikel Evins, which packages a
> Common Lisp implementation with Emacs, a powerful Lisp-aware text
> editor, and SLIME,[1] a Common Lisp development environment built on
> top of Emacs.
> "
>

You can see what Common Lisp implementation you are using by evaluating the next two forms:

[1]> (lisp-implementation-type)
"CLISP"
[2]> (lisp-implementation-version)
"2.45 (2008-05-15) (built on RJMBP.local [10.0.2.201])"

 
> I might want to inform the vendor but I have spent last 3 hours of
> mine by searching a meaningful description for that, so I am kinda
> annoyed now :S . anyway dude, thanks for your concern and messages.
> regards :))

No problem, dude. Have fun writing some Lisp code, dude. ;-)

-- 
http://lispm.dyndns.org/