[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scheme 102
From: |
rm |
Subject: |
Re: Scheme 102 |
Date: |
Wed, 28 Nov 2001 19:20:14 +0100 |
User-agent: |
Mutt/1.0.1i |
On Wed, Nov 28, 2001 at 11:45:58AM -0600, address@hidden wrote:
>
> hello,
>
> is it possible to dynamically discover the number of parameters to a
> function?
>
> say you read a function name + parameters from stdin or from user input.
> how can i check the number of required parameters have been supplied
> without calling the function. this would avoid aborting when 2 param were
> supplied instead of 3 e.g
>
> ...read "f 1 2 3" from the command line
> ...fname is "f"
> ...list-of-params is "1 2 3"
>
> (define (f x y) (+ x y))
>
> ((eval (string->symbol fname)) list-of-params)
>
> ERROR: Wrong number of arguments to #<primitive-procedure f>
>
> any idea ?
Would this be what you are looking for?
| bash-2.05$ guile
| guile> (arity display)ay)
| 1 required and 1 optional argument.
| guile> (arity map)
| 2 or more arguments.
| guile>
HTH Ralf Mattes
> thx!
>
>
>
> _______________________________________________
> Guile-user mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/guile-user