Prepend a list of trees to the children of the root node. If self is a leaf, it is converted into a branch.
self
import * as Tree from 'effect-tree'const tree = Tree.tree(1, [Tree.of(2), Tree.of(3)])const changed = Tree.prependAll(tree, [Tree.of(4), Tree.of(5)])expect(Tree.getForest(changed)).toEqual([ Tree.of(4), Tree.of(5), Tree.of(2), Tree.of(3),]) Copy
import * as Tree from 'effect-tree'const tree = Tree.tree(1, [Tree.of(2), Tree.of(3)])const changed = Tree.prependAll(tree, [Tree.of(4), Tree.of(5)])expect(Tree.getForest(changed)).toEqual([ Tree.of(4), Tree.of(5), Tree.of(2), Tree.of(3),])
Tree underlying type.
The tree to modify.
A non-empty list of trees to prepend to the tree.
A new updated tree with the new nodes prepended.
Prepend a list of trees to the children of the root node. If
selfis a leaf, it is converted into a branch.Example
Type Param: A
Tree underlying type.
Param: self
The tree to modify.
Param: children
A non-empty list of trees to prepend to the tree.
Returns
A new updated tree with the new nodes prepended.