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

.. rst-class:: right

**protocol**

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

Queue protocol.

| **Author:** Paulo Moura
| **Version:** 1.2
| **Date:** 2019/5/23

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


| **Dependencies:**
|   (none)


| **Remarks:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. 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,NewQueue)``
| **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,NewQueue)``
| **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,NewQueue)``
| **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(Elements,Queue,NewQueue)``
| **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(+heap,?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,Head,NewQueue)``
| **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 predicates
--------------------

(none)

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

(none)

Operators
---------

(none)

.. seealso::

   :ref:`queue <queue/0>`

