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

From: Robby Findler (robby at cs.uchicago.edu)
Date: Thu Aug 30 11:00:56 EDT 2007

procedure? but I think you're missing the point of the puzzle.

Robby

On 8/30/07, Corey Sweeney <corey.sweeney at gmail.com> wrote:
> On 8/30/07, Noel Welsh <noelwelsh at gmail.com> wrote:
> > Certainly not in general.  Consider this:
> >
> > What is the type of the first argument to map?
>
> That would look like type "function"
>
> hmm, i could swear that there was something like this:
> > (function? (lambda (x) x))
> . reference to undefined identifier: function?
> > (proc? (lambda (x) x))
> . reference to undefined identifier: proc?
>
> maybe i'm thinking of a guile-ism
>
> However, I do see the issue that some procedure could accept either a
> number OR a string, which would not be a simple answer.
>
> Corey
>
>
> Corey
>
>
> >
> > 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
> >
>
>
> --
> ((lambda (y) (y y)) (lambda (y) (y y)))
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>


Posted on the users mailing list.