I am wondering why there is no built-in equality operator in Common Lisp for comparing CLOS objects (standard-classes). For instance, "equalp" can be applied on arrays, structures, hash-tables, however not on objects.
I assume a new test which descends an object and checks if slot-values are equalp can be written by the programmer, but I wonder if there is a reason for this not being part of the standard, since I imagine it's a fairly common thing to do? For instance, it seems the test functions for "make-hash-table" must be one of the built-in ones*, thus, I don't really see how to use objects as keys or values in a hash table.
*I've noticed there is a related question (Using Common Lisp CLOS objects as keys in a hashtable?), however it does not really answer my question.
Thanks and cheers!
M
EQ(works with hashtables as well), or you want to check if a specific slot is equal, which naturally requires you to write your own comparison function. - jkiiskiEQUAL?that doesEQUALPon everything except classes instances (i.e.STANDARD-OBJECT), and doesEQUAL?on all the slots (of course you must check if objects belong to the same class first and slots a bound). Slow, but probably what you want in 99% of cases, - mobiusengEQwhich Returns true if its arguments are the same, identical object? - Student