我想使用Common Lisp CLOS对象作为哈希表中的键.我觉得它会像这样简单:
(defclass my-class () ((a :accessor a :initarg a)))
(defun my-class= (my-instance-1 my-instance-2)
(equal (a my-instance-1) (a my-instance-2)))
(defparameter my-hash-table (make-hash-table :test #'my-class=))
Run Code Online (Sandbox Code Playgroud)
检查Common Lisp Hyperspec,似乎我只能使用eq,eql,equal或equalp来测试相等性.
有什么方法可以做到这一点吗?或者这只是一个真正的stoopid事情,这就是为什么标准不允许它?