Trait Setpub

Source
:trait(pub) Set { (Foldable Self) (Filterable Self) }
  .union ( (Self a) (Self a)  (Self a) )
  .intersection ( (Self a) (Self a)  (Self a) )
  .difference ( (Self a) (Self a)  (Self a) )
  .symmetric-difference ( (Self a) (Self a)  (Self a) )
  .is-subset ( (Self a) (Self a)  Bool )
  .is-superset ( (Self a) (Self a)  Bool )
  .is-disjoint ( (Self a) (Self a)  Bool )
  .contains ( (Self a) a  Bool )
Description

Unique-element collection trait. Requires Foldable + Filterable and carries the set-algebra methods. Concrete impls (HashSet, BTreeSet) supply the bodies. Unicode operator sugar (/// //…) desugars to these calls.

Required Methods

.union ( (Self a) (Self a) (Self a) )

Union of two sets. ( (Self a) (Self a) -> (Self a) )

.intersection ( (Self a) (Self a) (Self a) )

Intersection of two sets. ( (Self a) (Self a) -> (Self a) )

.difference ( (Self a) (Self a) (Self a) )

Elements in the first set not in the second. ( (Self a) (Self a) -> (Self a) )

.symmetric-difference ( (Self a) (Self a) (Self a) )

Elements in either set but not both. ( (Self a) (Self a) -> (Self a) )

.is-subset ( (Self a) (Self a) Bool )

true iff every element of the first is in the second. ( (Self a) (Self a) -> Bool )

.is-superset ( (Self a) (Self a) Bool )

true iff every element of the second is in the first. ( (Self a) (Self a) -> Bool )

.is-disjoint ( (Self a) (Self a) Bool )

true iff the two sets share no elements. ( (Self a) (Self a) -> Bool )

.contains ( (Self a) a Bool )

true iff a is an element of the set. ( (Self a) a -> Bool )