The queue data type provides a simple FIFO queue. There are two implementations of a queue in Elib, one using macros and one using functions. The names of the functions/macros in the two implementations are the same, but the efficiency of using one or the other vary greatly under different circumstances.
The implementation using macros should be used when you want to
byte-compile your own elisp program. This will be most efficient since
byte-compiling an elisp function using macros has the same effect as
using inline code in C
.
To use the queue data type, put the line
(require 'queue-f)
in your own elisp source file if you want to use the implementation using functions or
(require 'queue-m)
if you want to use the implementation using macros. This is the only difference between them, so it is easy to switch between them during debugging.
Not all functions in `queue-m.el' are implemented as macros, only the short ones. This does not make it less recommendable to use the macro version in your compiled code.
The following functions are provided by the queue:
(queue-create)
(queue-p queue)
t
if queue is a queue, otherwise return nil
.
(queue-enqueue queue element)
(queue-dequeue queue)
(queue-empty queue)
t
if queue is empty, otherwise return nil
.
(queue-first queue)
nil
if it is empty. The
element is not removed from the queue.
(queue-nth queue n)
nil
. The element is not removed from the queue.
(queue-last queue)
nil
if it is empty. The
element is not removed from the queue.
(queue-all queue)
nil
if
queue is empty. The oldest element in the queue is the first in
the list.
(queue-copy queue)
(queue-length queue)
(queue-clear queue)
Go to the first, previous, next, last section, table of contents.