protocol

# `queuep`

Queue protocol.

Author: Paulo Moura
Version: 1.2
Date: 2019/5/23
Compilation flags:
`static`
Dependencies:
(none)
Remarks:
(none)

- Public predicates

  - `empty/1`

  - `head/2`

  - `join/3`

  - `join_all/3`

  - `jump/3`

  - `jump_all/3`

  - `length/2`

  - `serve/3`

  - `as_list/2`

- Protected predicates

- Private predicates

- Operators

## Public predicates

### `empty/1`

True if the queue is empty.

Compilation flags:
`static`
Template:
`empty(Queue)`
Mode and number of proofs:
`empty(@queue)` - `zero_or_one`

### `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`

### `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`

### `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`

### `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`

### `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`

### `length/2`

Queue length.

Compilation flags:
`static`
Template:
`length(Queue,Length)`
Mode and number of proofs:
`length(+heap,?integer)` - `zero_or_one`

### `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`

### `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)

See also

queue