From: ·········@yahoo.se
Subject: test and body variables or expressions?
Date: 
Message-ID: <64e30f5b-e8f6-4b93-9126-1fc6f396a62a@x19g2000prg.googlegroups.com>
while-macro from grahams book:

(defmacro while (test rest body)
    '(do ()
        ((not ,test))
        ,@body))


is test and body official(so to speak) names/functions/expressions or
could i just as well write yomama or heyyou?

From: Joost Diepenmaat
Subject: Re: test and body variables or expressions?
Date: 
Message-ID: <87abk7gbt0.fsf@zeekat.nl>
·········@yahoo.se writes:

> while-macro from grahams book:
>
> (defmacro while (test rest body)
>     '(do ()
>         ((not ,test))
>         ,@body))

Are you sure it's not (defmacro while (test &rest body) ... ) or
(defmacro while (test &body body) ...) ?

> is test and body official(so to speak) names/functions/expressions or
> could i just as well write yomama or heyyou?

IIRC &body is only "special" in that editors indent body arguments
differently (less indentation than normal parameters). That may or may
not work for &rest body. Otherwise, &rest and &body are equivalent, and
you should be able to use whatever name you like.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
From: Ken Tilton
Subject: Re: test and body variables or expressions?
Date: 
Message-ID: <47f8178f$0$5603$607ed4bc@cv.net>
Joost Diepenmaat wrote:
> ·········@yahoo.se writes:
> 
> 
>>while-macro from grahams book:
>>
>>(defmacro while (test rest body)
>>    '(do ()
>>        ((not ,test))
>>        ,@body))
> 
> 
> Are you sure it's not (defmacro while (test &rest body) ... ) or
> (defmacro while (test &body body) ...) ?

I'd change fonts as well, that backquote looks way too much like a quote.

:)

kenny


-- 
http://smuglispweeny.blogspot.com/
http://www.theoryyalgebra.com/

"In the morning, hear the Way;
  in the evening, die content!"
                     -- Confucius
From: ·········@yahoo.se
Subject: Re: test and body variables or expressions?
Date: 
Message-ID: <3ad3b0d2-68d2-4dc0-9395-b21968b50eea@k37g2000hsf.googlegroups.com>
(defmacro while (test &rest body)
  `(do ()
       ((not ,test))
     ,@body))

is the correct one sorry
From: Joost Diepenmaat
Subject: Re: test and body variables or expressions?
Date: 
Message-ID: <8763uvgbpe.fsf@zeekat.nl>
Joost Diepenmaat <·····@zeekat.nl> writes:

> not work for &rest body. Otherwise, &rest and &body are equivalent, and
> you should be able to use whatever name you like.
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^ for the variables, I
                        mean. the &whatever keywords (I don't know what
                        they're called) /are/ special anyway.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
From: Pascal Costanza
Subject: Re: test and body variables or expressions?
Date: 
Message-ID: <65qf7kF2goah9U2@mid.individual.net>
Joost Diepenmaat wrote:
> Joost Diepenmaat <·····@zeekat.nl> writes:
> 
>> not work for &rest body. Otherwise, &rest and &body are equivalent, and
>> you should be able to use whatever name you like.
>                         ^^^^^^^^^^^^^^^^^^^^^^^^^^ for the variables, I
>                         mean. the &whatever keywords (I don't know what
>                         they're called) /are/ special anyway.

They are called lambda list keywords.


Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/
From: Pascal Costanza
Subject: Re: test and body variables or expressions?
Date: 
Message-ID: <65qeu7F2butrhU1@mid.individual.net>
·········@yahoo.se wrote:
> while-macro from grahams book:
> 
> (defmacro while (test rest body)
>     '(do ()
>         ((not ,test))
>         ,@body))
> 
> 
> is test and body official(so to speak) names/functions/expressions or
> could i just as well write yomama or heyyou?

You can use any parameter names (except for some of the names which are 
predefined Common Lisp variables).

However, note that Common Lisp IDEs typically provide the parameter 
names as documentation (for auto-completion, for example). So you want 
to use meaningful names, because that makes it easier to understand how 
to use them.


Pascal

-- 
1st European Lisp Symposium (ELS'08)
http://prog.vub.ac.be/~pcostanza/els08/

My website: http://p-cos.net
Common Lisp Document Repository: http://cdr.eurolisp.org
Closer to MOP & ContextL: http://common-lisp.net/project/closer/