.. index:: queuep .. _queuep/0: .. rst-class:: right **protocol** ``queuep`` ========== Queue protocol. | **Author:** Paulo Moura | **Version:** 1:3:0 | **Date:** 2020-12-09 | **Compilation flags:** | ``static`` | **Dependencies:** | (none) | **Remarks:** | (none) | **Inherited public predicates:** | (none) .. contents:: :local: :backlinks: top Public predicates ----------------- .. 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`` ------------ .. 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`` ------------ .. 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`` ------------ .. 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`` ------------ .. 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`` ------------ .. index:: jump_all/3 .. _queuep/0::jump_all/3: ``jump_all/3`` ^^^^^^^^^^^^^^ Adds the new elements at the front of the queue. The last element in the list will be at the front of the queue. | **Compilation flags:** | ``static`` | **Template:** | ``jump_all(Elements,Queue,NewQueue)`` | **Mode and number of proofs:** | ``jump_all(+list,+queue,-queue)`` - ``zero_or_one`` ------------ .. index:: jump_all_block/3 .. _queuep/0::jump_all_block/3: ``jump_all_block/3`` ^^^^^^^^^^^^^^^^^^^^ Adds the new elements as a block at the front of the queue. The first element in the list will be at the front of the queue. | **Compilation flags:** | ``static`` | **Template:** | ``jump_all_block(Elements,Queue,NewQueue)`` | **Mode and number of proofs:** | ``jump_all_block(+list,+queue,-queue)`` - ``zero_or_one`` ------------ .. index:: append/3 .. _queuep/0::append/3: ``append/3`` ^^^^^^^^^^^^ Appends two queues. The new queue will have the elements of the first queue followed by the elements of the second queue. | **Compilation flags:** | ``static`` | **Template:** | ``append(Queue1,Queue2,NewQueue)`` | **Mode and number of proofs:** | ``append(+queue,+queue,-queue)`` - ``one`` ------------ .. 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`` ------------ .. 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`` ------------ .. 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`` ------------ .. index:: map/2 .. _queuep/0::map/2: ``map/2`` ^^^^^^^^^ Applies a closure to all elements of a queue. | **Compilation flags:** | ``static`` | **Template:** | ``map(Closure,Queue)`` | **Meta-predicate template:** | ``map(1,*)`` | **Mode and number of proofs:** | ``map(+callable,+queue)`` - ``zero_or_one`` ------------ .. index:: map/3 .. _queuep/0::map/3: ``map/3`` ^^^^^^^^^ Applies a closure to all elements of a queue constructing a new queue. | **Compilation flags:** | ``static`` | **Template:** | ``map(Closure,Queue,NewQueue)`` | **Meta-predicate template:** | ``map(2,*,*)`` | **Mode and number of proofs:** | ``map(+callable,+queue,?queue)`` - ``zero_or_one`` ------------ Protected predicates -------------------- (none) Private predicates ------------------ (none) Operators --------- (none) .. seealso:: :ref:`queue `