[Ruby] eql? and hash on Sets

Ryan Davis ryand-ruby at zenspider.com
Sun Nov 25 16:28:51 PST 2007


On Nov 25, 2007, at 11:27 , Aaron Patterson wrote:

> I guess it didn't really.  Set just seemed to quack like an Array most
> of the time.  And since .eql? and .hash were implemented, I expected
> them to sort of act like Array as well.

Set is much more like a smalltalk data structure called a Bag, which  
is an unordered collection (that's it... it just holds STUFF w/o  
order). The only difference between a Set and a Bag is a Set has  
unique data, a Bag does not.




More information about the Ruby mailing list