I am trying to overload simple arithmetic operators such as +, *, etc
in order to make a certain set of procedures more universal. In particular
I have definitions such as:
(defmacro overload (name op)
`(progn
(overload-number-number ,name ,op)
(overload-vector-vector ,name)
(overload-vector-number ,name)
(overload-number-vector ,name)))
where an example of the "overload-number-number" macro may be:
(defmacro overload-number-number (name op)
`(defmethod ,name ((a1 number) (a2 number) &rest other-args)
(reduce #',name other-args
:initial-value (,op a1 a2))))
This works fine with "number"s and "vector"s since CLOS recognises these
as classes. But I cannot do
(defmethod plus ((a1 pvar) (a2 pvar) &rest other-args)
...)
since CM's "pvar" is not recognised by CLOS as a class. What might be the
best remedy to this problem? What would be the easiest way to define a
class "pvar"?
--
Zdzislaw Gustav Meglicki, ······@arp.anu.edu.au,
Automated Reasoning Program - CISR, and Plasma Theory Group - RSPhysS,
The Australian National University, G.P.O. Box 4, Canberra, A.C.T., 2601,
Australia, fax: (Australia)-6-249-0747, tel: (Australia)-6-249-0158