[plt-scheme] detecting parameter types (contracts?)
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