pyrsistent icon indicating copy to clipboard operation
pyrsistent copied to clipboard

Best way to insert multiple elements into a `pvector`?

Open ornamentist opened this issue 7 months ago • 0 comments

Is there a recommended way to insert multiple elements at a position in a pvector? The equivalent of the following Python list code:

>>> xs = [1, 2, 6, 7]
>>> xs[2:2] = [3, 4, 5]
>>> xs
[1, 2, 3, 4, 5, 6, 7]

I can see I could join three pvectors if necessary: a prefix vector, the inserted elements and a suffix vector but I figure there's probably a better way?

ornamentist avatar Jul 11 '24 08:07 ornamentist