##% Set class Set include Enumerable ##% self.[] >(*v) -> Set def self.[](*ary) Set.new end ##% self.new(?Enumerable) -> Set ##% self.new(?Enumerable) {u -> u'} -> Set def self.new(enum = nil) super() end # FIXME not union ##% intersection(Enumerable) -> Set def intersection(enum) Set.new end alias :& :intersection ##% union(Enumerable) -> Set def union(enum) Set.new end alias :+ :union alias :| :union # FIXME ##% difference(Enumerable) -> Set def difference(enum) Set.new end alias :- :difference ##% add(v) -> self def add(o) self end alias :<< :add alias :add? :add ##% ==(a) -> Boolean def ==(set) BOOLEAN end # FIXME ##% ^(Enumerable) -> Set def ^(enum) Set.new end ##% classify() {t -> a} -> Hash > def classify() {(yield _elt) => self} end ##% clear() -> self def clear() self end ##% clone() -> Set def clone() self end alias :dup :clone ##% collect!() {t -> v} -> self def collect!() yield _elt; self end alias :map! :collect! ##% delete(a) -> self def delete(o) self end alias :delete? :delete ##% delete_if() {t -> ?} -> self def delete_if() yield _elt; self end alias :reject! :delete_if ##% divide() {t -> ?} -> Set > ##% divide() {(t, t) -> ?} -> Set > def divide() yield _elt; Set[self] end ##% each() {t -> ?} -> self def each() yield _elt; self end ##% empty?() -> Boolean def empty?() BOOLEAN end ##% flatten() -> Set def flatten() self end ##% flatten!() -> self def flatten!() self end ##% include?(a) -> Boolean def include?(o) BOOLEAN end alias :member? :include? ##% inspect() -> String def inspect() '' end ##% size() -> Integer def size() 0 end alias :length :size ##% merge(Enumerable) -> self def merge(enum) self end ##% subset?(Set) -> Boolean def subset?(set) Boolean end alias :proper_subset? :subset? ##% superset?(Set) -> Boolean def superset?(set) BOOLEAN end alias :proper_superset? :superset? ##% replace(Enumerable) -> self def replace(enum) self end ##% subtract(Enumerable) -> self def subtract(enum) self end ##% to_a() -> Array def to_a() [_elt] end ##% _elt() -> t def _elt() end private :_elt end ##% SortedSet class SortedSet < Set ##% self.[] >(*v) -> SortedSet def self.[](*ary) SortedSet.new end ##% self.new(?Enumerable) -> SortedSet ##% self.new(?Enumerable) {u -> u'} -> SortedSet def self.new(enum = nil) super() end end