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

From: Corey Sweeney (corey.sweeney at gmail.com)
Date: Thu Aug 30 11:59:32 EDT 2007

I'm taking untyped data, and trying to pass it to scheme.  Of course,
in order to pass it to scheme, I need to give the data a scheme
datatype.

I think my solution is going to be to decompactify map, and pass the
parameters in at a differnt level, where I can gaurentee that only one
type can be accepted, and use that specific type to create the scheme
data structure.

Thanks for the thoughts,

Corey

On 8/30/07, Noel Welsh <noelwelsh at gmail.com> wrote:
> Indeed -- there is a dependency between the arguments.  This
> particular case is easily solved by unification -- the core of the
> Hindley-Milner type inference algorithm -- with the cost that you
> can't write particular classes of programs and have them type check w/
> HM.  For example, you cannot express functions, like map, that take a
> varying number of arguments.
> Nevertheless, HM is fairly simple and expressive.  If you're doing
> some kind of type checking on a restricted class of programs you might
> find it sufficient for your needs.
>
> N.
>
> On 8/30/07, Corey Sweeney <corey.sweeney at gmail.com> wrote:
> > hmm, your right.  I thought my particular needs were going to be
> > simple enough to not have to worry about this, but on second thought,
> > I might run into this.  The issue here being that the type of the
> > second argument depends on the first argument, and thus i don't know
> > wether to pass it a list of numbers or charactors, etc...
> >
> > I guess in my case, I could avoid the use of map, and just use the
> > static primatives that can be  used to create map....
> >
> > Corey
>


-- 
((lambda (y) (y y)) (lambda (y) (y y)))


Posted on the users mailing list.