[plt-scheme] Trouble using map with object methods
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
>