I have the following class:
(defclass category () ((cat-channel-name :accessor cat-channel-name :initarg :cat-channel-name :initform "" :type string :documentation "Name of the channel of this category") (cat-min :accessor cat-min :initarg :min :initform 0 :type number :documentation "Mininum value of category") (cat-max :accessor cat-max :initarg :max :initform 1 :type number :documentation "Maximum value of category")) (:documentation "A category"))
Now I would like to use this class as a key for a hash table. Instance addresses can be easily compared with eq . The problem, however, may be several identical instances of this category class, and I would like the hash table to recognize this as a key.
So, I tried to rewrite the argument :test the make-hash-table function as follows:
(make-hash-table :test
Unfortunately, this is unacceptable. :test should be a designation for one of the functions eq, eql, equal or equalp.
One way to solve this problem is to turn the category class into a structure, but I need it to be a class. Is there any way to solve this?
source share