in reply to Re: Re: C# reinvents @_
in thread C# reinvents @_

Says hding:
I had the same thought about Lisp when I first saw this post, but after looking around a bit, I wasn't able to find any way to do this properly in Common Lisp.

It seems to me that this is exactly what you want:

(defun myfunction (&rest args) ...)

In the body of myfunction, the parameter args is bound to the entire argument list, which is analogous to @_ in Perl.

I don't understand your point about &optional. I thought we were looking for a way to simulate Perl's parameter-passing mechanism in Common Lisp; this is it. Perl doesn't have &optional; instead, you're supposed to examine the contents of @_ and make a decision depending on how many elements it contains. With the args parameter above, you are free to do the same thing in the same way.

--
Mark Dominus
Perl Paraphernalia

Replies are listed 'Best First'.
Re: Re: C# reinvents @_
by hding (Chaplain) on Sep 21, 2001 at 23:13 UTC

    Yes, I mentioned this in another node somewhere in this discussion. I know that we can do that (which does suffice to address the original point). I was wondering about the extended question: is there a way to get the entire argument list while at the same time preserving the rest of Lisp's argument handling facilities? I may not have made that clear in this entry.