Removes the Nth direct child of the given tree. If the tree is a branch with a single child then a Leaf is returned. If the given index is out-of-bounds, or the given tree is a leaf, it is returned unchanged.
Leaf
import * as Tree from 'effect-tree'const tree = Tree.branch(1, [Tree.of(2), Tree.of(3), Tree.of(4)])const changed = Tree.removeNthChild(1, tree)expect(Tree.getForest(changed)).toEqual([Tree.of(2), Tree.of(4)]) Copy
import * as Tree from 'effect-tree'const tree = Tree.branch(1, [Tree.of(2), Tree.of(3), Tree.of(4)])const changed = Tree.removeNthChild(1, tree)expect(Tree.getForest(changed)).toEqual([Tree.of(2), Tree.of(4)])
Tree underlying type.
Index in root node forest of node that will be removed.
The tree from which a node will be removed.
The tree with on less node.
Removes the Nth direct child of the given tree. If the tree is a branch with a single child then a
Leafis returned. If the given index is out-of-bounds, or the given tree is a leaf, it is returned unchanged.Example
Type Param: A
Tree underlying type.
Param: n
Index in root node forest of node that will be removed.
Param: self
The tree from which a node will be removed.
Returns
The tree with on less node.