On 17/12/2007, <b class="gmail_sendername">Anders Ramsell</b> <<a href="mailto:anders@theheartofgold.org">anders@theheartofgold.org</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> Proposed new API (along the lines of Anders Ramsell's suggestion:<br> ><br> > Introduce the notion of a first .. last order in the queue.<br> > Elements normally enters the first end and exits the last end.
<br><br>Well, it does look a lot better than what we have today, but it<br>seems "backwards". I do think you enter a queue at the end.<br>Actually the only operations on a "queue" I tend to use is<br>(avoiding API names altogether) these:
</blockquote><div><br>I agree, the head or front of the queue is where the oldest or next member in line is, and the end or tail is where the most recent or last element.<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
- create a queue<br>- add element to queue (which is then last in queue)<br>- remove first element from queue for processing (waited the longest)<br>- remove element from queue (no longer relevant)</blockquote><div><br>I could imagine that you would also like to "peek" at the first element without removing it. 
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">The purpose being handling resources in the order they arrive<br>with the extra constraint that some resources "go away" before
<br>it's their turn.</blockquote><div><br>The question is if you add too many functions in the API for doing non-queue like operations to the queue if you have a queue left. You could en up with a more general sequence structure. What have people actually asked for?
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">That said, I'm sure the other operations also could be very useful<br>in certain circumstances. And even though I beleive that what you
<br>call "delete(Item, Q1) -> Q2" is what I called 'drop' (and I'd<br>still like that one added very much) I don't think the queue<br>module should house a wide variety of "list like" funtions.
<br></blockquote></div><br>You could probably need some list like traversing functions as the internal structure is supposed to be hidden. For example drop could be replaced with a more general filter function.<br><br>Robert
<br><br>