effect-tree
    Preparing search index...

    Variable insertAtConst

    insertAt: {
        <A>(self: Tree<A>, child: Tree<A>, n: number): Branch<A>;
        <A>(child: Tree<A>): (self: Tree<A>, n: number) => Branch<A>;
    } = ...

    Insert a tree before Nth child of the given tree. The tree is inserted so that it becomes the Nth child of the tree, and the previous Nth child becomes moves over to position N+1.

    Negative indexes are handled as offsets from the final tree in the forest so that inserting a tree to index -1 inserts the tree before the last tree of the forest. Use append to append after the last tree.

    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 tree is appended to the end of the forest.

    Type Declaration

    Tree underlying type.

    The tree to modify.

    Child to insert.

    A new updated tree with the new node inserted.