Menu

#185 Please add a method \\\'INSERT\\\' to the Queue class

v3.2.0
closed
Classes (154)
5
2012-08-14
2007-06-07
No

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'.

Discussion

  • Rick McGuire

    Rick McGuire - 2007-06-07

    Logged In: YES
    user_id=1125291
    Originator: NO

    Committed revision 439.

    Gee, I guess the reference card needs another update :-)

     
  • David Ashley

    David Ashley - 2007-06-08

    Logged In: YES
    user_id=931756
    Originator: NO

    The documentation has been updated for this change in tevision 441.

     
  • Rick McGuire

    Rick McGuire - 2007-06-20

    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'

     

Anonymous
Anonymous

Add attachments
Cancel