[plt-scheme] Typed scheme: Cannot apply expression of type Procedure, since it is not a function type

From: keydana at gmx.de (keydana at gmx.de)
Date: Thu May 27 15:53:02 EDT 2010

Hi,

continuing on the stuff from my last question (where I was asking for a way to find out a function's return type), I now try representing a function by a structure

(define-struct: Fun ((name : Symbol) (proc : Procedure) (args : (Listof Symbol)) (ret : Symbol)))

But when I try


(define f1 (make-Fun 'plus + '(n n) 'n))
((Fun-proc f1) 1 2)

or

(define f2 (make-Fun 'plus (lambda: ((x : Real) (y : Real)) (+ x y)) '(n n) 'n))
((Fun-proc f2) 1 2)

I get the error "Cannot apply expression of type Procedure, since it is not a function type"


What can I do to really get a function type? If all functions were of the same type, I'd try something like

(define-struct: Fun ((name : Symbol) (proc : (Any Any -> Any)) (args : (Listof Symbol)) (ret : Symbol)))

... but as things are, I have no idea what to do.

Thanks a lot in advance for any help,

Sigrid

Posted on the users mailing list.