[cdr-discuss] EQUALS, COMPARE and HASH-CODE
Willem Broekema
metawilm at gmail.com
Tue Mar 1 15:20:10 UTC 2011
On Tue, Mar 1, 2011 at 12:18 PM, Marco Antoniotti <marcoxa at cs.nyu.edu> wrote:
> Hi
> here is the second iteration for the "equality and comparison" proposal.
Marco,
I'm interested in this proposal as the need for custom equality
predicates and hash tables has come up in my work.
Here's feedback on the version you just sent:
- These example results seem wrong:
cl-prompt> (EQUALS "FOO" "Foo")
T
cl-prompt> (EQUALS "FOO" "Foo" :case-sensitive-p nil)
NIL
- That EQUALS (a array) (b array) looks at array-total-size instead of
the exact dimensions is surprising to me.
- Why does this return error, why is it not applying the (T T) method
that would return /= ?
cl-prompt> (COMPARE (make-array 3 :initial-element 0) (vector 1 2 42))
Error: Uncomparable objects #(0 0 0) and #(1 2 42).
- It seems EQUALS and HASH-CODE are not usable in combination for hash
tables, if the keys are numbers (sxhash of = numbers of different
types, like 2 and 2.0, can be different) or arrays (sxhash could look
at dimensions, not just array-total-size). That would be unfortunate.
- Willem
More information about the cdr-discuss
mailing list