Note that, under this definition

a:Dequeue(Integer):= dequeue [1,2,3,4,5]
b:Queue(Integer):= queue [1,2,3,4,5]

hash(a) == hash(b)

This is because the internal data representation of both objects is:

 ((1 2 3 4 5))

Nevertheless, this is a perfectly reasonable hash function.

Tim


Bill Page wrote:
Tim,

Besides the fact that from the standard we only have that

  (equal x y) implies (= (sxhash x) (sxhash y)).

Do you see any reason why SXHASH is not used by default in SetCategory?

Note: OpenAxiom currently defines this default:

  add
      hash(s : %):  SingleInteger == SXHASH(s)$Lisp

Regards,
Bill Page.

On Mon, Nov 9, 2009 at 7:51 PM, Tim Daly <[email protected]> wrote:
...
There is a lisp function to get the hash value of any object
call sxhash. You can call it.

SXHASH(a)$Lisp

Note that if

c:=Integer

then
EQ(a,c)$Lisp is false
SXHASH(a)$Lisp is not equal to SXHASH(c)$Lisp

Thus the hash function you seek already exists.
You just have to accept the fact that Spad is only syntactic
sugar for lisp code and lisp is not evil.




_______________________________________________
Axiom-developer mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/axiom-developer

Reply via email to