[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ] Procedure arity

Interface to query procedure's arity. The API is taken from MzScheme (PLT Scheme).

Function: arity proc
Given procedure proc, returns an integer, an arity-at-least object, or a list of integer(s) and arity-at-least objects.

An integer result indicates proc takes exactly that number of arguments. An arity-at-least indicats proc takes at least (arity-at-least-value arity-at-least) arguments. The list indicates there are multiple procedures with different arities.

Since one can add methods to an existing procedure or generic function at any moment in Gauche, the value returned by arity only indicates the current state of the procedure. It will change if new method is added to the procedure/generic-function.

(arity cons) => 2
(arity list) => #<arity-at-least 0>
(arity make) => (#<arity-at-least 1>)

Function: arity-at-least? obj
Returns true if obj is an arity-at-least object.

Function: arity-at-least-value arity-at-least
Returns the number of required arguments the arity-at-least object indicates.

Function: procedure-arity-includes? proc k
If a procedure proc can take k arguments, returns #t. Otherwise returns #f.

This document was generated by Ken Dickey on November, 28 2002 using texi2html