Inserts an element into the array at the given index.
All following elements are shifted to the right, having their index
incremented by one.
Error(Nil) is returned if the index is less than 0 or greater than
length(array).
If the index is equal to length(array), this function behaves like
copy_push.
Performance
This function has to copy the entire array, making it very inefficient
especially for larger arrays.
Examples
> from_list(["a", "b"]) |> copy_insert(0, "c")
Ok(from_list(["c", "a", "b"]))
> from_list(["a", "b"]) |> copy_insert(1, "c")
Ok(from_list(["a", "c", "b"]))
> from_list(["a", "b"]) |> copy_insert(2, "c")
Ok(from_list(["a", "b", "c"]))
> from_list(["a", "b"]) |> copy_insert(3, "c")
Error(Nil)