Skip to content

Instantly share code, notes, and snippets.

@bkerley
Created December 19, 2012 23:25
Show Gist options
  • Save bkerley/4341605 to your computer and use it in GitHub Desktop.
Save bkerley/4341605 to your computer and use it in GitHub Desktop.
# encoding: utf-8
require 'set'
require 'pp'
class Set
def ∩(*args)
intersection *args
end
def ∪(*args)
union *args
end
def ⊂(*args)
subset? *args
end
def ⊃(*args)
superset? *args
end
end
first = Set.new %w{a b c d}
second = Set.new %w{c d e f}
c = Set.new %w{c}
pp first.∩ second
pp first.∪ second
pp c.⊂ first
pp second.⊃ c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment