The intsets module implements an efficient int set implemented as a sparse bit set. Note: Since Nim currently does not allow the assignment operator to be overloaded, = for int sets performs some rather meaningless shallow copy; use assign to get a deep copy.
Procs
proc contains(s: IntSet; key: int): bool {.
raises: [], tags: [].}- returns true iff key is in s. Source Edit
proc incl(s: var IntSet; key: int) {.
raises: [], tags: [].}- includes an element key in s. Source Edit
proc incl(s: var IntSet; other: IntSet) {.
raises: [], tags: [].}- Includes all elements from other into s. Source Edit
proc excl(s: var IntSet; key: int) {.
raises: [], tags: [].}- excludes key from the set s. Source Edit
proc excl(s: var IntSet; other: IntSet) {.
raises: [], tags: [].}- Excludes all elements from other from s. Source Edit
proc missingOrExcl(s: var IntSet; key: int): bool {.
raises: [], tags: [].}- returns true if s does not contain key, otherwise key is removed from s and false is returned. Source Edit
proc containsOrIncl(s: var IntSet; key: int): bool {.
raises: [], tags: [].}- returns true if s contains key, otherwise key is included in s and false is returned. Source Edit
proc initIntSet(): IntSet {.
raises: [], tags: [].}- creates a new int set that is empty. Source Edit
proc clear(result: var IntSet) {.
raises: [], tags: [].}- Source Edit
proc isNil(x: IntSet): bool {.
inline, raises: [], tags: [].}- Source Edit
proc assign(dest: var IntSet; src: IntSet) {.
raises: [], tags: [].}- copies src to dest. dest does not need to be initialized by initIntSet. Source Edit
proc union(s1, s2: IntSet): IntSet {.
raises: [], tags: [].}- Returns the union of the sets s1 and s2. Source Edit
proc intersection(s1, s2: IntSet): IntSet {.
raises: [], tags: [].}- Returns the intersection of the sets s1 and s2. Source Edit
proc difference(s1, s2: IntSet): IntSet {.
raises: [], tags: [].}- Returns the difference of the sets s1 and s2. Source Edit
proc symmetricDifference(s1, s2: IntSet): IntSet {.
raises: [], tags: [].}- Returns the symmetric difference of the sets s1 and s2. Source Edit
proc `+`(s1, s2: IntSet): IntSet {.
inline, raises: [], tags: [].}- Alias for union(s1, s2). Source Edit
proc `*`(s1, s2: IntSet): IntSet {.
inline, raises: [], tags: [].}- Alias for intersection(s1, s2). Source Edit
proc `-`(s1, s2: IntSet): IntSet {.
inline, raises: [], tags: [].}- Alias for difference(s1, s2). Source Edit
proc disjoint(s1, s2: IntSet): bool {.
raises: [], tags: [].}- Returns true iff the sets s1 and s2 have no items in common. Source Edit
proc len(s: IntSet): int {.
inline, raises: [], tags: [].}- Returns the number of keys in s. Source Edit
proc card(s: IntSet): int {.
inline, raises: [], tags: [].}- alias for len() <#len> _. Source Edit
proc `<=`(s1, s2: IntSet): bool {.
raises: [], tags: [].}- Returns true iff s1 is subset of s2. Source Edit
proc `<`(s1, s2: IntSet): bool {.
raises: [], tags: [].}- Returns true iff s1 is proper subset of s2. Source Edit
proc `==`(s1, s2: IntSet): bool {.
raises: [], tags: [].}- Returns true if both s and t have the same members and set size. Source Edit
proc `$`(s: IntSet): string {.
raises: [], tags: [].}- The $ operator for int sets. Source Edit
proc empty(s: IntSet): bool {.
inline, deprecated, raises: [], tags: [].}- returns true if s is empty. This is safe to call even before the set has been initialized with initIntSet. Note this never worked reliably and so is deprecated. Source Edit