Round Robin with Token Pool
1 post
• Page 1 of 1
Round Robin with Token Pool
Consider repeatedly selecting an item from a list where we always want the next item, and we reach the end, we go back to the beginning, a round-robin selection.
If we take the list and chuck it into the token pool:
And then get and put at the same time:
We can select via a round robin method:
I thought this might be an overkill use of the token pool, but I think it might be faster than any other technique, and also avoids deciding where to store the list.
I am continually amazed at how I managed to live before the token pool came in to existence!
If we take the list and chuck it into the token pool:
'ABCDE' ⎕TPUT¨5
And then get and put at the same time:
f←{r⊣(r←⎕TGET 5) ⎕TPUT 5}
We can select via a round robin method:
f 0
A
f 0
B
f 0
C
f¨⍳10
DEABCDEABC
I thought this might be an overkill use of the token pool, but I think it might be faster than any other technique, and also avoids deciding where to store the list.
I am continually amazed at how I managed to live before the token pool came in to existence!
- paulmansour
- Posts: 343
- Joined: Fri Oct 03, 2008 4:14 pm
1 post
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group