From ... Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!134.222.94.5!npeer.kpnqwest.net!reader3.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: Finding the arity of a function References: Mail-Copies-To: never From: Erik Naggum Message-ID: <3209816844401584@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 25 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 18 Sep 2001 15:47:24 GMT X-Complaints-To: newsmaster@Norway.EU.net X-Trace: reader3.kpnqwest.net 1000828044 193.90.205.112 (Tue, 18 Sep 2001 17:47:24 MET DST) NNTP-Posting-Date: Tue, 18 Sep 2001 17:47:24 MET DST Xref: archiver1.google.com comp.lang.lisp:16459 * Mathew Sanders > Does anyone know of a function in lisp that given another function > returns the arity? The arity of a function in Common Lisp is given by two values, not just one, the lower bound being the number of required arguments and an upper bound being the number of additional &optional arguments, and finally, may not be bounded except by sysetm limits on the number of &rest or &key arguments. The various implementations have different ways to access this information, which is usually kept in some other place in addition to the code that checks for the correct number of arguments. I think LWW's choice of name for the accessor, function-lambda-list, is good, so this function will give you the same function portably bewteen LWW and Allegro CL: #+allegro (defun function-lambda-list (function) (excl:arglist function)) Usually, the function describe will tell you about argument lists and other useful stuff, and in the free Common Lisp implementations, you can find out how they do that by looking at the source. ///