Re: Bugs in set and sorted-set (?)

2009-02-15 Thread Jason Wolfe
On Feb 14, 9:13 pm, "Stephen C. Gilardi" wrote: > On Feb 14, 2009, at 11:10 PM, Chouser wrote: > > > I don't think that's quite right.  I don't think it matters in this > > case, but hash values aren't guaranteed unique.  A hash-map can have > > two keys with the same hash value as long as = retu

Re: Bugs in set and sorted-set (?)

2009-02-15 Thread Frantisek Sodomka
It is making more sense now. One other interesting thing that surprised me is: "There is not a total ordering across types." See discussion: http://groups.google.com/group/clojure/browse_frm/thread/710848919c68981f/51ede18b2fd7ab96?lnk=gst&q=sorted-set#51ede18b2fd7ab96 Therefore things like (so

Re: Bugs in set and sorted-set (?)

2009-02-15 Thread Rich Hickey
On Feb 14, 11:10 pm, Chouser wrote: > On Sat, Feb 14, 2009 at 7:19 PM, Stephen C. Gilardi wrote: > > > > > "set" is a hash set. It will never contain two items with equal hashes. > > I don't think that's quite right. I don't think it matters in this > case, but hash values aren't guaranteed u

Re: Bugs in set and sorted-set (?)

2009-02-14 Thread Stephen C. Gilardi
On Feb 14, 2009, at 11:10 PM, Chouser wrote: I don't think that's quite right. I don't think it matters in this case, but hash values aren't guaranteed unique. A hash-map can have two keys with the same hash value as long as = returns false. Vectors and lists with the same values evaluate as

Re: Bugs in set and sorted-set (?)

2009-02-14 Thread Chouser
On Sat, Feb 14, 2009 at 7:19 PM, Stephen C. Gilardi wrote: > > "set" is a hash set. It will never contain two items with equal hashes. I don't think that's quite right. I don't think it matters in this case, but hash values aren't guaranteed unique. A hash-map can have two keys with the same h

Re: Bugs in set and sorted-set (?)

2009-02-14 Thread Stephen C. Gilardi
On Feb 14, 2009, at 6:38 PM, Frantisek Sodomka wrote: Function 'set' looses some of its data. It seems that there is a problem with comparison between lists and vectors: "set" is a hash set. It will never contain two items with equal hashes. user=> (hash [1 2]) 994 us

Re: Bugs in set and sorted-set (?)

2009-02-14 Thread Frantisek Sodomka
Similar is: user=> #{[] ()} #{[]} user=> #{[] [1 2]} #{[] [1 2]} user=> (hash-set [] ()) #{[]} Frantisek On Feb 15, 12:38 am, Frantisek Sodomka wrote: > Hello! > Function 'set' looses some of its data. It seems that there is a > problem with comparison between lists and vectors: > > user=> (cou

Bugs in set and sorted-set (?)

2009-02-14 Thread Frantisek Sodomka
Hello! Function 'set' looses some of its data. It seems that there is a problem with comparison between lists and vectors: user=> (count [nil false true 0 42 0.0 3.14 2/3 0M 1M \c "" "abc" 'sym :kw () '(1 2) [] [1 2] {} {:a 1 :b 2} #{} #{1 2}]) 23 user=> (set [nil false true 0 42 0.0 3.14 2/3 0M