Divide set
require 'set' s = (0..3).to_set # => #<Set: {0, 1, 2, 3}> s.divide {|x| x%2} # => #<Set: {#<Set: {0, 2}>, #<Set: {1, 3}>}>