Right now
List(1,2,3).Splice(0, 0, List(4))
returns
List(4,1,2,3)
List(1,2,3).Splice(1, 0, List(4))
also returns List(4,1,2,3)
.
This is a huge bummer for the times when we would like to truly append an item to the end of the list.
How can I get List(1,2,3,4)
? Well, the best I can do is:
WithName(List(1,2,3), MyList, MyList.Splice(MyList.Count()+1, 0, List(4)))
If I were to come across this formula in a doc I would be quite confused as to what it was doing. It seems unnecessarily verbose considering what it’s doing is basically List(1,2,3).Append(List(4))
.
Since MyList.Splice(0,0, whatever)
returns the same thing as MyList.Splice(1, 0, whatever)
it would be nice to use 0
as append and 1
as prepend.