Using Sets in Ruby
ruby, set
Solution
`Set` is part of the standard library, so it shouldn't pose any dependency problems. If it's the cleanest way to solve the problem, go for it.
Regarding use (or lack thereof) I think there are probably two main reasons:
- programmers not being aware of the library
- programmers not realising when sets are the best way to a solution
- programmers not knowing/remembering anythign about sets at all.
Make that three main reasons.
Problem
I'm building a simple Ruby on Rails plugin and I'm considering using the Set class. I don't see the Set class used all too often in other people's code. Is there a reason why people choose to use (subclasses of) Array rather than a set? Would using a set introduce dependecy problems for some people?