.. index:: queuep
.. _queuep/0:

**protocol**

``queuep``
==========

Queue protocol.

| **Author:** Paulo Moura
| **Version:** 1.0
| **Date:** 2000/7/24

| **Compilation flags:**
|    ``static``


(no dependencies on other entities)


Public interface
----------------

.. raw:: html

   <div id="empty/1"> </div>

.. index:: empty/1
.. _queuep/0::empty/1:

``empty/1``
^^^^^^^^^^^

True if the queue is empty.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``empty(Queue)``
| **Mode and number of proofs:**
|    ``empty(@queue)`` - ``zero_or_one``


.. raw:: html

   <div id="head/2"> </div>

.. index:: head/2
.. _queuep/0::head/2:

``head/2``
^^^^^^^^^^

Unifies Head with the first element of the queue.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``head(Queue,Head)``
| **Mode and number of proofs:**
|    ``head(+queue,?term)`` - ``zero_or_one``


.. raw:: html

   <div id="join/3"> </div>

.. index:: join/3
.. _queuep/0::join/3:

``join/3``
^^^^^^^^^^

Adds the new element at the end of the queue.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``join(Element,Queue_in,Queue_out)``
| **Mode and number of proofs:**
|    ``join(@term,+queue,-queue)`` - ``zero_or_one``


.. raw:: html

   <div id="join_all/3"> </div>

.. index:: join_all/3
.. _queuep/0::join_all/3:

``join_all/3``
^^^^^^^^^^^^^^

Adds the new elements at the end of the queue.  The elements are added in the same order that they appear in the list.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``join_all(List,Queue_in,Queue_out)``
| **Mode and number of proofs:**
|    ``join_all(+list,+queue,-queue)`` - ``zero_or_one``


.. raw:: html

   <div id="jump/3"> </div>

.. index:: jump/3
.. _queuep/0::jump/3:

``jump/3``
^^^^^^^^^^

Adds the new element at the front of the queue.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``jump(Element,Queue_in,Queue_out)``
| **Mode and number of proofs:**
|    ``jump(@term,+queue,-queue)`` - ``zero_or_one``


.. raw:: html

   <div id="jump_all/3"> </div>

.. index:: jump_all/3
.. _queuep/0::jump_all/3:

``jump_all/3``
^^^^^^^^^^^^^^

Adds the new elements at the front of the queue.  The elements are added in the same order that they appear in the list.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``jump_all(Element,Queue_in,Queue_out)``
| **Mode and number of proofs:**
|    ``jump_all(+list,+queue,-queue)`` - ``zero_or_one``


.. raw:: html

   <div id="length/2"> </div>

.. index:: length/2
.. _queuep/0::length/2:

``length/2``
^^^^^^^^^^^^

Queue length.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``length(Queue,Length)``
| **Mode and number of proofs:**
|    ``length(+queue,?integer)`` - ``zero_or_one``


.. raw:: html

   <div id="serve/3"> </div>

.. index:: serve/3
.. _queuep/0::serve/3:

``serve/3``
^^^^^^^^^^^

Removes the first element of the queue for service.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``serve(Queue_in,Head,Queue_out)``
| **Mode and number of proofs:**
|    ``serve(+queue,?term,-queue)`` - ``zero_or_one``


.. raw:: html

   <div id="as_list/2"> </div>

.. index:: as_list/2
.. _queuep/0::as_list/2:

``as_list/2``
^^^^^^^^^^^^^

Converts a queue to a list.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``as_list(Queue,List)``
| **Mode and number of proofs:**
|    ``as_list(+queue,-list)`` - ``one``


Protected interface
-------------------

(none)

Private predicates
------------------

(none)

Operators
---------

(none)

Remarks
-------

(none)

.. seealso::

   :ref:`queue <queue/0>`

