Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
No such thing as a small change
 
PerlMonks  

Re: C# reinvents @_

by Dominus (Parson)
on Sep 21, 2001 at 06:52 UTC ( [id://113819]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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 19: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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://113819]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.