#lang scheme/base (require scheme/class scheme/contract) (provide/contract [get-callable (object? symbol? . -> . procedure?)]) ;; get-callable: object symbol -> (any* -> any) ;; Given an object and a symbol that names a method, returns ;; a closure that can call that method. (define (get-callable an-obj method-name-id) (let* ([an-interface (object-interface an-obj)] [a-generic (make-generic an-interface method-name-id)]) (lambda args (send-generic an-obj a-generic . args))))