Hello,

I found some strange behaviour in the hash function.

When applied to numbers, it works ok, but when applied
to strings, it leads to a huge number of collisions. 

An example:
# ==========================================================

(setq N 50000
      Lnumbers (range 1 N)
      Lstrings (mapcar format (range 1 N)) )

(prinl "uniq hashed values, using " N " different numbers: "
   (length (uniq (mapcar hash Lnumbers))) )

(prinl "uniq hashed values, using " N " different strings: "
   (length (uniq (mapcar hash Lstrings))) )

(bye)

# ==========================================================
# PRINTED RESULTS:
# ----------------
# uniq hashed values, using 50000 different numbers: 50000
# uniq hashed values, using 50000 different strings: 10271
# ==========================================================

enrique.




-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to