set_
Set family: an unordered collection of unique elements in a shape fabric.
Module nu.domains.shape.set_.
Set family: an unordered collection of unique elements in a shape fabric.
Forms weave the Python set surface with the shape collection ops, tier by tier, and type every result by what the slot declared: an element reads as the declared value's form, and set algebra carries the declared element type on.
Refs bind that surface to an address. A set has no keys, so there is no descent.
| Name | Sort | Call | Meaning |
|---|---|---|---|
| MutableSetRef | ref | MutableSetRef(address, parent_ref=None, owner_shape=None) | Mutable unordered unique-element container Ref. |
| ReactiveSetRef | ref | ReactiveSetRef(address, parent_ref=None, owner_shape=None) | Reactive unordered unique-element container Ref. |
| SetRef | ref | SetRef(address, parent_ref=None, owner_shape=None) | Unordered unique-element container Ref; no child descent. |
MutableSetRef
Mutable unordered unique-element container Ref.
MutableSetRef(address, parent_ref=None, owner_shape=None)Path nu.domains.shape.MutableSetRef. Kind Ref, sort ref, cardinality scalar.
Adds: add(v), remove(v), discard(v), pop(), update(), ..., store(v), erase().
Inherited methods
From nu.forms.collections.abc.set_.MutableSetForm:
| Call | Builds | Meaning |
|---|---|---|
.add(value) | Any | Add value to self. |
.remove(value, missing_ok=False) | Any | Remove value from self. |
.discard(value) | Any | Remove value from self if present. |
.pop() | ElementResultT | Remove and return an arbitrary element from self. |
.clear() | Any | Remove every element from self. |
.update(other) | Any | Add every element of other to self. |
.intersection_update(other) | Any | Keep only the elements of self also found in other. |
.difference_update(other) | Any | Remove every element of other from self. |
.symmetric_difference_update(other) | Any | Keep the elements in exactly one of self and other. |
From nu.domains.shape.set_.SetLikeForm:
| Call | Builds | Meaning |
|---|---|---|
.iter() | Iterator | A lazy stream over its elements, typed by the declared value. |
From nu.forms.collections.abc.set_.SetLikeForm:
| Call | Builds | Meaning |
|---|---|---|
.union(other) | CollectionResultT | Union of self and other. |
.intersection(other) | CollectionResultT | Intersection of self and other. |
.difference(other) | CollectionResultT | Elements of self that are not in other. |
.symmetric_difference(other) | CollectionResultT | Elements in exactly one of self and other, not both. |
.issubset(other) | Bool | Whether every element of self is in other. |
.issuperset(other) | Bool | Whether every element of other is in self. |
.isdisjoint(other) | Bool | Whether self and other share no elements. |
.copy() | CollectionResultT | Shallow copy of self. |
From nu.forms.collections.abc.collection.CollectionForm:
| Call | Builds | Meaning |
|---|---|---|
.extract() | object | Materialise the full subtree rooted at self. |
From nu.forms.collections.abc.sized.SizedForm:
| Call | Builds | Meaning |
|---|---|---|
.len() | Int | Length of self. |
From nu.forms.collections.abc.container.ContainerForm:
| Call | Builds | Meaning |
|---|---|---|
.contains(item) | Bool | Whether item is a member of self. |
From nu.domains.shape.collection.MutableCollectionForm:
| Call | Builds | Meaning |
|---|---|---|
.set(value) | SetCmd | Build a SetCmd. |
.erase() | Erase | Build an Erase. |
.init(value) | IfDo | Set value iff the collection is currently missing. |
From nu.domains.shape.collection.CollectionForm:
| Call | Builds | Meaning |
|---|---|---|
.exists() | Bool | Whether this collection slot holds a value, as a Bool. |
.missing() | Bool | Whether this slot holds no value, as a Bool: the negation of exists(). |
From nu.lang.forms.Form:
| Call | Builds | Meaning |
|---|---|---|
a == b | Bool | Self equal to other by value: an Eq term, never a Python bool. |
a != b | Bool | Self not equal to other by value: a Ne term, never a Python bool. |
.is_empty() | Bool | True if this Form yields the EMPTY sentinel. |
.not_empty() | Bool | True if this Form does not yield EMPTY. |
.fallback(*alternatives) | Self | The first of this value and alternatives that is not EMPTY. |
Undocumented: example.
ReactiveSetRef
Reactive unordered unique-element container Ref.
ReactiveSetRef(address, parent_ref=None, owner_shape=None)Path nu.domains.shape.ReactiveSetRef. Kind Ref, sort ref, cardinality scalar.
Adds: on_change(), on_child_change(), on_children_change(), on_descendants_change() on top of MutableSetRef.
Inherited methods
From nu.forms.collections.abc.set_.ReactiveSetForm:
| Call | Builds | Meaning |
|---|---|---|
.on_change() | object | Subscribe to any change on this set slot. |
From nu.forms.collections.abc.set_.MutableSetForm:
| Call | Builds | Meaning |
|---|---|---|
.add(value) | Any | Add value to self. |
.remove(value, missing_ok=False) | Any | Remove value from self. |
.discard(value) | Any | Remove value from self if present. |
.pop() | ElementResultT | Remove and return an arbitrary element from self. |
.clear() | Any | Remove every element from self. |
.update(other) | Any | Add every element of other to self. |
.intersection_update(other) | Any | Keep only the elements of self also found in other. |
.difference_update(other) | Any | Remove every element of other from self. |
.symmetric_difference_update(other) | Any | Keep the elements in exactly one of self and other. |
From nu.domains.shape.set_.SetLikeForm:
| Call | Builds | Meaning |
|---|---|---|
.iter() | Iterator | A lazy stream over its elements, typed by the declared value. |
From nu.forms.collections.abc.set_.SetLikeForm:
| Call | Builds | Meaning |
|---|---|---|
.union(other) | CollectionResultT | Union of self and other. |
.intersection(other) | CollectionResultT | Intersection of self and other. |
.difference(other) | CollectionResultT | Elements of self that are not in other. |
.symmetric_difference(other) | CollectionResultT | Elements in exactly one of self and other, not both. |
.issubset(other) | Bool | Whether every element of self is in other. |
.issuperset(other) | Bool | Whether every element of other is in self. |
.isdisjoint(other) | Bool | Whether self and other share no elements. |
.copy() | CollectionResultT | Shallow copy of self. |
From nu.forms.collections.abc.collection.CollectionForm:
| Call | Builds | Meaning |
|---|---|---|
.extract() | object | Materialise the full subtree rooted at self. |
From nu.forms.collections.abc.sized.SizedForm:
| Call | Builds | Meaning |
|---|---|---|
.len() | Int | Length of self. |
From nu.forms.collections.abc.container.ContainerForm:
| Call | Builds | Meaning |
|---|---|---|
.contains(item) | Bool | Whether item is a member of self. |
From nu.domains.shape.collection.ReactiveCollectionForm:
| Call | Builds | Meaning |
|---|---|---|
.on_child_change(address) | OnChildChange | Observe writes at one child's own address; for its subtree use on_descendants_change. |
.on_children_change() | OnChildrenChange | Observe writes at the direct children only; for subtrees use on_descendants_change. |
.on_descendants_change() | OnDescendantsChange | Observe changes across descendants matching pattern. |
From nu.domains.shape.collection.MutableCollectionForm:
| Call | Builds | Meaning |
|---|---|---|
.set(value) | SetCmd | Build a SetCmd. |
.erase() | Erase | Build an Erase. |
.init(value) | IfDo | Set value iff the collection is currently missing. |
From nu.domains.shape.collection.CollectionForm:
| Call | Builds | Meaning |
|---|---|---|
.exists() | Bool | Whether this collection slot holds a value, as a Bool. |
.missing() | Bool | Whether this slot holds no value, as a Bool: the negation of exists(). |
From nu.lang.forms.Form:
| Call | Builds | Meaning |
|---|---|---|
a == b | Bool | Self equal to other by value: an Eq term, never a Python bool. |
a != b | Bool | Self not equal to other by value: a Ne term, never a Python bool. |
.is_empty() | Bool | True if this Form yields the EMPTY sentinel. |
.not_empty() | Bool | True if this Form does not yield EMPTY. |
.fallback(*alternatives) | Self | The first of this value and alternatives that is not EMPTY. |
Undocumented: example.
SetRef
Unordered unique-element container Ref; no child descent.
SetRef(address, parent_ref=None, owner_shape=None)Path nu.domains.shape.SetRef. Kind Ref, sort ref, cardinality scalar.
Inherited methods
From nu.domains.shape.set_.SetLikeForm:
| Call | Builds | Meaning |
|---|---|---|
.iter() | Iterator | A lazy stream over its elements, typed by the declared value. |
From nu.forms.collections.abc.set_.SetLikeForm:
| Call | Builds | Meaning |
|---|---|---|
.union(other) | CollectionResultT | Union of self and other. |
.intersection(other) | CollectionResultT | Intersection of self and other. |
.difference(other) | CollectionResultT | Elements of self that are not in other. |
.symmetric_difference(other) | CollectionResultT | Elements in exactly one of self and other, not both. |
.issubset(other) | Bool | Whether every element of self is in other. |
.issuperset(other) | Bool | Whether every element of other is in self. |
.isdisjoint(other) | Bool | Whether self and other share no elements. |
.copy() | CollectionResultT | Shallow copy of self. |
From nu.forms.collections.abc.collection.CollectionForm:
| Call | Builds | Meaning |
|---|---|---|
.extract() | object | Materialise the full subtree rooted at self. |
From nu.forms.collections.abc.sized.SizedForm:
| Call | Builds | Meaning |
|---|---|---|
.len() | Int | Length of self. |
From nu.forms.collections.abc.container.ContainerForm:
| Call | Builds | Meaning |
|---|---|---|
.contains(item) | Bool | Whether item is a member of self. |
From nu.domains.shape.collection.CollectionForm:
| Call | Builds | Meaning |
|---|---|---|
.exists() | Bool | Whether this collection slot holds a value, as a Bool. |
.missing() | Bool | Whether this slot holds no value, as a Bool: the negation of exists(). |
From nu.lang.forms.Form:
| Call | Builds | Meaning |
|---|---|---|
a == b | Bool | Self equal to other by value: an Eq term, never a Python bool. |
a != b | Bool | Self not equal to other by value: a Ne term, never a Python bool. |
.is_empty() | Bool | True if this Form yields the EMPTY sentinel. |
.not_empty() | Bool | True if this Form does not yield EMPTY. |
.fallback(*alternatives) | Self | The first of this value and alternatives that is not EMPTY. |
Undocumented: example.