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

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

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

On 8/30/07, Noel Welsh <noelwelsh at gmail.com> wrote:
> Ok, so why doesn't this work?
>
> > (procedure? +)
> #t
> > (map + (list 'a 'b 'c))
> +: expects argument of type <number>; given a
>
> N.
>
> [Robby is right, and I'm hoping you'll come to enlightenment by my
> asking annoying questions]
>
> 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
>


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


Posted on the users mailing list.