Skip to main content

fold_nodes

Function fold_nodes 

Source
pub fn fold_nodes<S: AsRef<str>>(
    names: &[S],
    fold_axis: Option<&[i64]>,
) -> String
Expand description

Fold a list of node names into compact bracket notation, honoring a fold-axis constraint.

fold_axis is None to fold along all axes (upstream default), or Some(axes) with 0-indexed axes (negative values resolved modulo the dimension count), mirroring NodeSet.fold_axis semantics:

  • 1D patterns fold only when fold_axis is None or contains an axis x with -1 <= x < 1; otherwise they expand.
  • nD patterns fold each axis in the resolved set and expand the others.

Patterns are emitted sorted alphabetically; elements within a pattern follow RangeSet ordering, like the Python oracle.