There should be a way to rehash a
s = Set.new([]) s.first << 1 # s.rehash # Does not exist! s.include?  # => false, want true
This method resets the internal state of a set after modification to
existing elements, reindexing and deduplicating them. [Feature #6589]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Updated by marcandre (Marc-Andre Lafortune) almost 7 years ago
headius (Charles Nutter) wrote:
Is it specified that Set must be hashtable-based forever? There are alternate ways to implement a Set.
Alternate ways of implementing Set with check/insertion in O(1) that would also work if structures change without a
In any case, the documentation states that "Set uses Hash as storage", but more importantly that "The equality of each couple of elements is determined according to
Updated by knu (Akinori MUSHA) over 6 years ago
Actually, an undocumented "feature" is that Set does not support an element being modified once it is added.
Maybe we should "clarify" that in the document, or add such a method that recalculates identities of elements. I'm yet to decide which, and the name we could give it.
- rehash (let's be honest)
- reset (re-set the set)