home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!munnari.oz.au!manuel.anu.edu.au!arp!gustav
- From: gustav@arp.anu.edu.au (Zdzislaw Meglicki)
- Newsgroups: comp.lang.lisp
- Subject: declaring CM pvars as classes
- Date: 6 Jan 1993 09:25:59 GMT
- Organization: Centre for Information Science Research, ANU, Canberra, Australia
- Lines: 34
- Sender: gustav@arp (Zdzislaw Meglicki)
- Distribution: world
- Message-ID: <1ie8j7INNdmh@manuel.anu.edu.au>
- NNTP-Posting-Host: 150.203.20.14
- Keywords: *Lisp, CLOS
-
- 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, gustav@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
-