Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: round-robin on varying sequence

by Arien (Pilgrim)
on Sep 07, 2002 at 05:41 UTC ( [id://195843]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://195843]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2025-01-13 14:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (32 votes). Check out past polls.