[plt-scheme] Trouble using map with object methods

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Jul 9 18:20:34 EDT 2005

On Jul 9, 2005, at 6:05 PM, Marc Fernandez Vilaseca wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> 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))

Do you know what quote means? It does NOT mean form a list. -- Matthias



>
> (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.