hydra.overlay.python.lib.sets module

Python implementations of hydra.overlay.python.lib.sets primitives.

Inputs accept any AbstractSet; outputs are PersistentSet instances (returned as AbstractSet[A]). PersistentSet is structurally shared through its underlying PersistentMap, so chained primitives get O(log n) updates instead of the O(n) full-rebuild that frozenset imposed.

hydra.overlay.python.lib.sets.delete(x: A, s: Set[A]) Set[A]

Delete an element from a set.

hydra.overlay.python.lib.sets.difference(s1: Set[A], s2: Set[A]) Set[A]

Compute the difference of two sets.

hydra.overlay.python.lib.sets.empty() Set[Any]

Create an empty set.

hydra.overlay.python.lib.sets.filter(p: Callable[[A], bool], s: Set[A]) Set[A]

Filter a set by a predicate.

hydra.overlay.python.lib.sets.from_list(xs: Sequence[A]) Set[A]

Create a set from a list.

hydra.overlay.python.lib.sets.insert(x: A, s: Set[A]) Set[A]

Insert an element into a set. O(log n).

hydra.overlay.python.lib.sets.intersection(s1: Set[A], s2: Set[A]) Set[A]

Compute the intersection of two sets.

hydra.overlay.python.lib.sets.is_empty(s: Set[Any]) bool

Check if a set is empty.

hydra.overlay.python.lib.sets.map(f: Callable[[A], B], s: Set[A]) Set[B]

Map a function over a set.

hydra.overlay.python.lib.sets.member(x: A, s: Set[A]) bool

Check if an element is in a set.

hydra.overlay.python.lib.sets.singleton(x: A) Set[A]

Create a singleton set.

hydra.overlay.python.lib.sets.size(s: Set[Any]) int

Get the size of a set.

hydra.overlay.python.lib.sets.to_list(s: Set[A]) Sequence[A]

Convert a set to a list, in element order.

hydra.overlay.python.lib.sets.union(s1: Set[A], s2: Set[A]) Set[A]

Compute the union of two sets.

hydra.overlay.python.lib.sets.unions(sets: Sequence[Set[A]]) Set[A]

Compute the union of multiple sets.