Pudu programming language
Menu
API reference

Std.Tree.flatMap

1 declaration

fn

flatMap: &Std.Tree.Tree[A] -> fn(A) -> Std.Tree.Tree[B] -> Std.Tree.Tree[B]

This is a callable function.

What it does

Each value replaced by a whole tree, grafted where the value stood.

The tree a node produces takes that node's place, and the node's own

children follow the produced tree's children beneath the same root. A

transform that answers leaf for every value is map; one that answers a

deeper tree expands the hierarchy in place, which is what an outline does

when a heading is replaced by the section it names.

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