guile-user
[Top][All Lists]
Advanced

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

Scheme 102


From: bciceron
Subject: Scheme 102
Date: Wed, 28 Nov 2001 11:45:58 -0600 (CST)

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 ?

thx!





reply via email to

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