in reply to round-robin on varying sequence

How about chucking the $index and rotating the array (shift and push) every time you get an element (which is now always the first)?

remove is now as trivial as it ought to be:

sub remove { my %del = map { $_ => 1 } @_; @items = grep { not $del{$_} } @items; }

— Arien

Replies are listed 'Best First'.
Re: Re: round-robin on varying sequence
by dpuu (Chaplain) on Sep 07, 2002 at 19:12 UTC
    Unless I'm missing something, this doesn't help. You still need to track an index so that you know where to insert items (now via a splice) for add_item(). Once you've rotated the list, you can no longer simply append to the end. --Dave