[plt-scheme] Trouble using map with object methods

From: Marc Fernandez Vilaseca (pseudomarc at gmail.com)
Date: Sat Jul 9 18:05:30 EDT 2005

Hi all, 

I hope someone can help me with this. I am just beginning to learn
Scheme, and I'm probably making some dumb mistake.

When I run the following code under MzScheme/MrEd I get the error
"send: target is not an object: an-object for method: double":

(define a-class 
  (class object%
    (define/public (double x) (* 2 x))
  (super-instantiate())))

(define an-object
  (new a-class))

(define another-object
  (new a-class))

(define a-list
  '(an-object another-object))

(define (map-double object-list)  
  (map
   (lambda (item)
     (send item double 3))
   object-list))

(map-double a-list)

Anyone can see what's wrong with the code above?

Many thanks,

Marc



Posted on the users mailing list.