Pudu programming language
Menu
API reference

Std.Tree.mapWithPath

1 declaration

fn

mapWithPath: &Std.Tree.Tree[A] -> fn(Array[Int], A) -> B -> Std.Tree.Tree[B]

This is a callable function.

What it does

Every value transformed, told where in the tree it sits.

The path is the child index taken at each step from the root, so the root is

given an empty path. A transform that needs to know its depth reads the

path's length; one that needs to know it is a first child reads its last

step.

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