Unfortunately, at the moment it is not possible to insert an object in the middle of a queue. However, when using a queue collection object, at times it becomes important to be able to insert a new object in the middle of the queue (e.g. representing people who cut lines, etc.). It should follow the semantics of the List class' 'INSERT'.
Anonymous
Logged In: YES
user_id=1125291
Originator: NO
Committed revision 439.
Gee, I guess the reference card needs another update :-)
Logged In: YES
user_id=931756
Originator: NO
The documentation has been updated for this change in tevision 441.
Logged In: YES
user_id=1125291
Originator: NO
This adds an INSERT() method to the queue class. This is essentially the same as the list one, with the additional note that the index positions of items after the inserted item will be adjusted for the insertion. That is,
q = .queue~of('a', 'b', 'c')
say q[3] -- displays 'c'
q~insert('d', 1)
say q[3] -- now displays 'b'