Insert a list of trees before Nth child of the given tree. The list is
inserted so that the head element of the inserted list becomes the Nth child
of the tree, and the previous Nth child is pushed after the inserted list.
Negative indexes are handled as offsets from the final tree in the forest so
that inserting a list to index -1 inserts the list before the last
tree of the forest. Use appendAll to append after the last tree
in the forest.
If self is a leaf, it is converted into a branch.
If the index is out-of-bounds, I.E.: negative or greater than `forest length
1`, the list is appended to the end of the forest.
Type Param: A
Tree underlying type.
Param: self
The tree to modify.
Param: children
Non-empty list of child trees to insert.
Returns
A new updated tree with the new child trees inserted.
Insert a list of trees before Nth child of the given tree. The list is inserted so that the head element of the inserted list becomes the Nth child of the tree, and the previous Nth child is pushed after the inserted list.
Negative indexes are handled as offsets from the final tree in the forest so that inserting a list to index
-1inserts the list before the last tree of the forest. Use appendAll to append after the last tree in the forest.If
selfis a leaf, it is converted into a branch.If the index is out-of-bounds, I.E.: negative or greater than `forest length
Type Param: A
Tree underlying type.
Param: self
The tree to modify.
Param: children
Non-empty list of child trees to insert.
Returns
A new updated tree with the new child trees inserted.