chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Runtime arity?


From: Graham Fawcett
Subject: Re: [Chicken-users] Runtime arity?
Date: Tue, 29 Jan 2008 11:32:22 -0500

On Jan 29, 2008 11:28 AM, Mark Fredrickson <address@hidden> wrote:
> Is it possible to determine at run time the arity of function? I'm
> thinking something like
>
> (arity (lambda (x y z) (* x y z)))
> => 3

You can use 'procedure-information':

(procedure-information (lambda (x y z) (* x y z)))

=> (? x y z)

where (? x y z) is an s-expression that you can parse.
It's of less use when the procedure takes variable arguments, though,
and of course it doesn't tell you whether the procedure returns
multiple values.

Graham




reply via email to

[Prev in Thread] Current Thread [Next in Thread]