Classify set elements as even or odd
require 'set' s = (0..3).to_set # => #<Set: {0, 1, 2, 3}> s.classify {|x| x%2} # => {0=>#<Set: {0, 2}>, 1=>#<Set: {1, 3}>}