Pudu programming language
Menu
API reference

Std.Tree.unfold

1 declaration

fn

unfold: S -> fn(S) -> (T, Array[S]) -> Std.Tree.Tree[T]

This is a callable function.

What it does

A tree grown from a starting value.

grow answers what a node holds and the seeds of its children, and the tree

ends where it answers no seeds. Nothing here bounds the growing: a grow

that never answers an empty sequence describes an infinite tree and will not

finish, exactly as a while whose condition never fails will not. Use

unfoldTo where the depth is not known to be finite.

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.
  • Names inside [ ] are type arguments, such as the item type held by a collection.

Back to Std.TreeSearch related declarations