Pudu programming language
Menu
API reference

Std.Tree.levels

1 declaration

fn

levels: &Std.Tree.Tree[T] -> Array[Array[T]]

This is a callable function.

What it does

The values at each depth, nearest the root first.

Held a level at a time rather than a node at a time: the whole of one depth

is gathered, then its children become the next depth. That keeps the walk to

one pass and needs no queue, and the levels are what a caller usually wanted

anyway — a menu's rows, a chart's ranks.

Read the signature

  • The text after the name is the type checked by Pudu.
  • Read arrows from left to right: inputs come first, and the final type is returned.
  • & borrows a value for this call instead of moving or copying it.
  • Names inside [ ] are type arguments, such as the item type held by a collection.

Back to Std.TreeSearch related declarations