jacopy.brackets.BracketApply

class jacopy.brackets.BracketApply(bracket, a, b)

Bases: Expr

Inert application of a bracket: B(a, b).

Carries a reference to the GradedBracket instance so the expand_bracket() algorithm (and expand()) can delegate back to the bracket’s expansion rule. The bracket itself is not an Expr, treating it as such would invite accidental structural comparisons between two different brackets that happen to share a name or degree.

Parameters:
__init__(bracket, a, b)
Parameters:
Return type:

None

Methods

__init__(bracket, a, b)

clone()

Return self.

expand([registry])

Defer to the bracket's expansion rule.

find(predicate)

Yield descendants (including self) satisfying predicate.

replace_at(path, new)

Return a new tree with new spliced at path.

substitute_atom(dummy, target)

Return self with every occurrence of dummy replaced by target.

walk()

Pre-order traversal yielding self followed by descendants through children only.

Attributes

a

b

bracket

children

Tuple of immediate children.

is_atom

property children: Tuple[Expr, ...]

Tuple of immediate children. Atoms return ().

expand(registry=None)

Defer to the bracket’s expansion rule.

Parameters:

registry (PropertyRegistry | None)

Return type:

Expr