archimedes.tree.allΒΆ

archimedes.tree.all(tree: Tree, is_leaf: Callable[[Any], bool] | None = None) boolΒΆ

Check if all leaves in the tree evaluate to True.

Parameters:
  • tree (Tree) – A tree to check.

  • is_leaf (callable, optional) – A function that takes a tree node as input and returns a boolean indicating whether it should be considered a leaf.

Returns:

result – True if all leaves in the tree evaluate to True, False otherwise.

Return type:

bool

See also

tree_map

Apply a function to each leaf in a tree

tree_leaves

Extract just the leaf values from a tree