effect-tree - v1.0.36
    Preparing search index...

    Function binaryTree

    • Create a binary level tree at the given depth. In a level tree, the value of each node is set to its depth.

      At the key string you will find a version that returns the tree where nodes have been formatted as strings instead of number.

      import {binaryTree, drawTree, type Tree} from 'effect-tree'

      const tree: Tree<number> = binaryTree(3)

      console.log(drawTree(tree).join('\n'))

      // prints:
      // ┬1
      // ├┬2
      // │├─3
      // │└─3
      // └┬2
      // ├─3
      // └─3

      Parameters

      • depth: number

        Tree depth requested. Tree returned is perfectly balanced. When depth is zero returns a leaf.

      Returns Tree<number>

      A binary level tree of the given depth..

    Index

    Properties

    Properties

    string: (...a: [depth: number]) => Tree