2
0
Fork 0
mirror of https://github.com/bazelbuild/bazel-skylib synced 2024-11-30 10:41:18 +00:00
bazel-skylib/docs/new_sets_doc.md
River a81c2c0efe
Regenerate new_sets.bzl docs. (#280)
Lists are not supported. The code comments were fixed to match this in 2d620ba1f8, but the docs were never updated.
2020-10-15 14:20:00 -04:00

5.8 KiB
Executable file

sets.make

sets.make(elements)

Creates a new set.

All elements must be hashable.

PARAMETERS

Name Description Default Value
elements Optional sequence to construct the set out of. None

sets.copy

sets.copy(s)

Creates a new set from another set.

PARAMETERS

Name Description Default Value
s A set, as returned by sets.make(). none

sets.to_list

sets.to_list(s)

Creates a list from the values in the set.

PARAMETERS

Name Description Default Value
s A set, as returned by sets.make(). none

sets.insert

sets.insert(s, e)

Inserts an element into the set.

Element must be hashable. This mutates the original set.

PARAMETERS

Name Description Default Value
s A set, as returned by sets.make(). none
e The element to be inserted. none

sets.contains

sets.contains(a, e)

Checks for the existence of an element in a set.

PARAMETERS

Name Description Default Value
a A set, as returned by sets.make(). none
e The element to look for. none

sets.is_equal

sets.is_equal(a, b)

Returns whether two sets are equal.

PARAMETERS

Name Description Default Value
a A set, as returned by sets.make(). none
b A set, as returned by sets.make(). none

sets.is_subset

sets.is_subset(a, b)

Returns whether a is a subset of b.

PARAMETERS

Name Description Default Value
a A set, as returned by sets.make(). none
b A set, as returned by sets.make(). none

sets.disjoint

sets.disjoint(a, b)

Returns whether two sets are disjoint.

Two sets are disjoint if they have no elements in common.

PARAMETERS

Name Description Default Value
a A set, as returned by sets.make(). none
b A set, as returned by sets.make(). none

sets.intersection

sets.intersection(a, b)

Returns the intersection of two sets.

PARAMETERS

Name Description Default Value
a A set, as returned by sets.make(). none
b A set, as returned by sets.make(). none

sets.union

sets.union(args)

Returns the union of several sets.

PARAMETERS

Name Description Default Value
args An arbitrary number of sets. none

sets.difference

sets.difference(a, b)

Returns the elements in a that are not in b.

PARAMETERS

Name Description Default Value
a A set, as returned by sets.make(). none
b A set, as returned by sets.make(). none

sets.length

sets.length(s)

Returns the number of elements in a set.

PARAMETERS

Name Description Default Value
s A set, as returned by sets.make(). none

sets.remove

sets.remove(s, e)

Removes an element from the set.

Element must be hashable. This mutates the original set.

PARAMETERS

Name Description Default Value
s A set, as returned by sets.make(). none
e The element to be removed. none

sets.repr

sets.repr(s)

Returns a string value representing the set.

PARAMETERS

Name Description Default Value
s A set, as returned by sets.make(). none

sets.str

sets.str(s)

Returns a string value representing the set.

PARAMETERS

Name Description Default Value
s A set, as returned by sets.make(). none