[plt-scheme] Printing and Overloading

From: Paulo Jorge de Oliveira Cantante de Matos (pocm at netvisao.pt)
Date: Wed Mar 17 20:17:08 EST 2004

Hi all,

I've been thinking about this lately bout I've not had the time to try
things out. However, as the result of some hours of research I found
nothing in PLT Scheme that allows me to easily do one of the following
things:

Imagine I have a structure/class tuple (x1, x2) and I want to:

1. Overload primitive +, so that (+ (make-tuple 2 3) (make-tuple 2 3))
gives me (4, 6).

2. Print the tuple so that (write (make-tuple 2 3)) or even (format "~a"
(make-tuple 2 3)) prints something like "(2, 3)".

Is there anyway to do this in PLT-Scheme? If there is, can somebody
please explain it or direct me to the main references? 

Cheers, 
-- 

Paulo J. Matos : pocm [_at_] mega . ist . utl . pt
Instituto Superior Tecnico - Lisbon
Computer and Software Eng. - A.I.
 - > http://mega.ist.utl.pt/~pocm
---
        -> God had a deadline...
                So, he wrote it all in Lisp!



Posted on the users mailing list.