------art_87887_23842674.1168865847403
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 1/15/07, Jason Mayer <slamboy / gmail.com> wrote:
>
> I'm just curious if there's any way to duplicate values in a set.  After
> quiz 108, I modified my submission so that it was a fully functional game.
>
> I then passed around my finished program to some of my coworkers who are
> interested in ruby.  After a few days, someone came back to me with a bug,
> and this appears to be the root cause of that bug.
>
> irb(main):001:0> target  stuff"
> "stuff"
> irb(main):002:0> a  arget.split(//).sort
> ["f", "f", "s", "t", "u"]
> irb(main):003:0> require 'Set'
> true
> irb(main):004:0> s1  et.new(a)
> #<Set: {"f", "s", "t", "u"}>
>
> As it stands, if the word ffffuuuuussssstttt existed, it would be
> considered
> a subset of a.  How do you avoid this using sets?



Doh!  first line of ri Set told me what I needed to know - that it's not
really possible.

Set implements a collection of unordered values with no duplicates.

------art_87887_23842674.1168865847403--