Add Array.insert
AlienKevin opened this issue · comments
Kevin Xiang Li commented
Insert an element to an array at a specific index (can be negative).
insert : Int -> a -> Array a -> Array a
insert i el arr =
Array.append
( Array.push el <|
Array.slice 0 i arr
)
(Array.slice i (Array.length arr) arr)
Check out sample tests on Ellie
Kevin Xiang Li commented
I saw the insertAt
pull request so I'm closing this issue. Could someone publish the new version with insertAt
though?
Jonathan Boiser commented
@prikhi Would you be able to create a new release with this feature?
Pavan Rikhi commented
Sure, happy to help.
Pavan Rikhi commented
New release pushed.