Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/HAN-ASD-DT/priority-queue is gone (deleted or private); Software Heritage has not archived the repo; no fork with tag 2.1.0 found (24 same-name repos checked); no cached copy. Use another version.
A priority queue for Elm.
A priority queue is an
abstract data type which is like a regular queue or stack data structure, but where additionally each element has a "priority" associated with it. In a priority queue, an element with high priority is served before an element with low priority.
The implementation we provide here is based on Okasaki's leftist heaps. See Purely Functional Data Structures for more information.
Throughout this package priority will mean a function that assigns a integer value to an element. Lower values indicate higher priority and vice versa.
A function that assigns a priority to elements.
Lower values correspond to higher priority.
Create an empty PriorityQueue.
Insert an element into the PriorityQueue
Creates a PriorityQueue from a given list of elements.
Must be given a priority function, i.e. a function that assigns the priority to elements.
Return the element of the PriorityQueue with the highest priority.
Returns Nothing when the queue is empty.
Return the PriorityQueue that remains when the head is removed.
Return the first n elements of the PriorityQueue with the highest priority
Returns a new PriorityQueue with the first n elements dropped.
Determine if the PriorityQueue is empty.
Returns all the elements in a PriorityQueue as a List.
The order will be determined by the priority, higher priority elements before lower priority elements.
The abstract datatype of this package.