Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

parameters with &aux

8 views
Skip to first unread message

Montse

unread,
Dec 7, 2000, 3:00:00 AM12/7/00
to
I don´t know how work parameters in lisp with &aux before their
example (defun view (p1 p2 &aux r1 r2) ..

and I don´t know they work.

I need know this for understand a problem,

Can help me somebody and explain how they work??

Thanks

Martti Halminen

unread,
Dec 7, 2000, 3:00:00 AM12/7/00
to
Montse wrote:
>
> I don´t know how work parameters in lisp with &aux before their
> example (defun view (p1 p2 &aux r1 r2) ..
>
> and I don´t know they work.


(defun view (p1 p2 &aux r1 r2) ..

should work the same way as

(defun view (p1 p2)
(let (r1 r2) ..)
--

Erik Naggum

unread,
Dec 7, 2000, 3:00:00 AM12/7/00
to
* "Montse" <mon...@issnet.net>

| I don´t know how work parameters in lisp with &aux before their
| example (defun view (p1 p2 &aux r1 r2) ..
| and I don´t know they work.
|
| I need know this for understand a problem,
|
| Can help me somebody and explain how they work??

They are just like let-bindings in the function body.

(defun view (p1 p2 &aux r1 r2)

...)

is functionally identical to

(defun view (p1 p2)
(let (r1 r2)

..))

#:Erik
--
"When you are having a bad day and it seems like everybody is trying
to piss you off, remember that it takes 42 muscles to produce a
frown, but only 4 muscles to work the trigger of a good sniper rifle."
-- Unknown

Martti Halminen

unread,
Dec 7, 2000, 3:00:00 AM12/7/00
to
Kent M Pitman wrote:
>
> Martti Halminen <martti....@solibri.com> writes:

> > (defun view (p1 p2 &aux r1 r2) ..
> >

> > should work the same way as
> >

> > (defun view (p1 p2)
> > (let (r1 r2) ..)
>

> Uh, LET* actually, not LET. In the case you cite, there is no difference.
> But you can do:
>
> (defun foo (x &aux (y (+ x 1)) (z (+ x y))) ...)
>
> and it will bind variables left to right.
>
> (Personally, I just never use &aux. I think it bad style.)

Yeah, I so seldom use it I haven't needed that much detail. About the
only place I've needed it was when modifying some AutoLisp stuff to run
in CL, and was too lazy to add the let/let*.
- AutoLisp is even more odd style: (defun view (p1 p2 / r1 r2) ...

--

Sunil Mishra

unread,
Dec 7, 2000, 12:27:21 PM12/7/00
to
Erik Naggum wrote:

> * "Montse" <mon...@issnet.net>
> | I don´t know how work parameters in lisp with &aux before their
> | example (defun view (p1 p2 &aux r1 r2) ..
> | and I don´t know they work.
> |
> | I need know this for understand a problem,
> |
> | Can help me somebody and explain how they work??
>
> They are just like let-bindings in the function body.
>

> (defun view (p1 p2 &aux r1 r2)

> ...)
>
> is functionally identical to
>

> (defun view (p1 p2)
> (let (r1 r2)

> ..))
>
> #:Erik

A slight error here. CLHS 3.4.1.5:


&aux variable processing is analogous to let* processing.

(lambda (x y &aux (a (car x)) (b 2) c) (list x y a b c))
== (lambda (x y) (let* ((a (car x)) (b 2) c) (list x y a b c)))

S

Kent M Pitman

unread,
Dec 7, 2000, 12:29:32 PM12/7/00
to
Martti Halminen <martti....@solibri.com> writes:

> Montse wrote:
> >
> > I don´t know how work parameters in lisp with &aux before their
> > example (defun view (p1 p2 &aux r1 r2) ..
> >
> > and I don´t know they work.
>
>
> (defun view (p1 p2 &aux r1 r2) ..
>

> should work the same way as
>

> (defun view (p1 p2)

0 new messages