Q:

Unordered Couple in Ruby

I would like to calculate the similarity between users, which is reciprocal.
similarity[:user1][:user2] == similarity[:user2][:user1]
So it would be great to use:
unordered_set(:user1, :user2) = 1
unordered_set(:user2, :user1) += 1

read_unordered_set(:user1, :user2) #=> 2
read_unordered_set(:user2, :user1) #=> 2

How can I get a similar behaviour in Ruby?

A:

http://www.ruby-doc.org/core/classes/Set.html
[1, 2].to_set == [2, 1].to_set

Might help...

