[plt-scheme] detecting parameter types (contracts?)

From: Noel Welsh (noelwelsh at gmail.com)
Date: Thu Aug 30 10:48:27 EDT 2007

Certainly not in general.  Consider this:

What is the type of the first argument to map?

N.

On 8/30/07, Corey Sweeney <corey.sweeney at gmail.com> wrote:
> Is there a way to automatically detect paramater types of the
> primative functions?  I'm guessing not, but perhaps the "contracts"
> functions have something in them.  While this example is highly
> contrived, I'll present a example to be clear on what i'm looking for:
>
> (+ (if (equal? 'number (get-type-of-parameter-1 +))
>        2
>        "nifty string")
>    7)
>
> or in english:
> Given the function +, is there a way to automatically determine wether
> i should be passing it a number, a symbol, or a string?
>
>
> Corey


Posted on the users mailing list.