On Thu, Nov 24, 2011 at 11:22 AM, Ismael Figueroa Palet <ifiguer...@gmail.com> wrote: > I got the following error: "Type Checker: Cannot apply expression of type > Procedure, since it is not a function type" > > What is the rationale behind this?
Probably the error message should be better here, but what's going on is that `Procedure' is a type where all we know is that it's a function, and nothing else. We don't know how many arguments (or keyword arguments) it requires, and we don't know what types those arguments should be. So there's no possible way to safely apply it. > I'm constructing a function wrapper that uses apply, but I don't know how to > type a function in the most general way. > > The code is like: > > (define (wrapper fun . args) ... > ... (apply fun args)) > > I expect functions to have any numbers/types of arguments but always return > a type B. > > I tried something like (All (A) (A ... A -> B)) but it does not catch all > cases... so I tried to use the type Procedure, which according to the > documentation "is the supertype of all function types." I would write this just like you did: (: wrap (All (B A ...) (A ... -> B) A ... -> B)) (define (wrap f . args) (apply f args)) What problem did you have with this? -- sam th sa...@ccs.neu.edu _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users