[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: overriding system functions.



> i wish to define functions on sets such as intersection and implement the
> sets using clos.  however, i wish to use the standard lisp intersection
> within the clos methods.  is this possible using lisp?

Certainly. Something like this:

(defpackage "SETS" (:USE "COMMON-LISP") (:SHADOW "INTERSECTION"))
(in-package "SETS")
(defgeneric intersection (bag1 bag2 &key test test-not key))
(defmethod intersection ((bag1 sequence) (bag2 sequence) &rest more)
  (apply #'lisp:intersection bag1 bag2 more)
)

                    Bruno Haible
                    haible@ma2s2.mathematik.uni-karlsruhe.de