# PriorityQueue

## Vars | |

L | List. The actual queue. |
---|---|

cmp | Proc path. The weight function used to order the queue. |

## Procs | |

Dequeue | Removes and returns the first element in the queue, or `FALSE` if the queue is empty. |

Enqueue | Adds an element to the queue, immediately ordering it to its position using the function defined in `cmp` . |

Get | Returns the element at position `i` (1-indexed), or `FALSE` if the position does not exist. |

IsEmpty | Checks if the queue is currently empty. Returns boolean. Mirrors to `!length(L)` |

Length | Returns the length of the queue. Mirrors to `length(L)` |

List | Returns a copy of the queue as a list. Mirrors to `L.Copy()` |

ReSort | Repositions the given element to the correct position in the queue using the function defined in `cmp` . |

Remove | Removes an element from the queue. Returns boolean, indicating whether an item was removed or not. Mirrors to `L.Remove(A)` |

Seek | Returns the position of an element or `FALSE` if not found. Mirrors to `L.Find(A)` |

## Var Details

### L

List. The actual queue.

### cmp

Proc path. The weight function used to order the queue.

## Proc Details

### Dequeue

Removes and returns the first element in the queue, or `FALSE`

if the queue is empty.

### Enqueue

Adds an element to the queue, immediately ordering it to its position using the function defined in `cmp`

.

### Get

Returns the element at position `i`

(1-indexed), or `FALSE`

if the position does not exist.

### IsEmpty

Checks if the queue is currently empty. Returns boolean. Mirrors to `!length(L)`

### Length

Returns the length of the queue. Mirrors to `length(L)`

### List

Returns a copy of the queue as a list. Mirrors to `L.Copy()`

### ReSort

Repositions the given element to the correct position in the queue using the function defined in `cmp`

.

The element must already exist in the queue to be resorted.

Has no return value.

### Remove

Removes an element from the queue. Returns boolean, indicating whether an item was removed or not. Mirrors to `L.Remove(A)`

### Seek

Returns the position of an element or `FALSE`

if not found. Mirrors to `L.Find(A)`