[erlang-questions] : : queues (previously: documentation of data structures)

Andreas Hillqvist andreas.hillqvist@REDACTED
Mon Dec 17 14:05:10 CET 2007


I intrepid Raimo proposal as being FIFO.

You add to the beginning(put/2 or put_first/2), removing from the
end(get/1 or get_last/1).
First item will be last in list even if new element is added, therefor
first in will be first out.
(Unless you use put_last.)

I don't see any point in arguing over:
 * "Add to beginning and remove from end" or
 * "Add to end and remove from beginning"
It will still be a FIFO or did I miss something?


Regards
Andreas Hillqvist

2007/12/17, Andras Georgy Bekes <bekesa@REDACTED>:
> > Elements normally enters the first end and exits the last end.
> >
> > Regular (forward) direction:
> >
> > put_first(Item, Q1) -> Q2
> > get_last(Q) -> Item
>
> A queue is "FIFO" (First In First Out), so the first element is the one
> that entered the queue first, and that will leave the queue first.
>
> Your proposal is the opposite of this. Why?
>
>         Georgy
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list