(pfds priority-search-queue)

psq? : obj -> boolean returns #t if the object is a priority search queue, #f otherwise.

(make-psq key<? priority<?)

make-psq : < < -> psq takes a two ordering procedures, one for keys, and another for priorities, and returns an empty priority search queue

(psq-empty? psq)

psq-empty? : psq -> boolean returns #t if the priority search queue contains no elements, #f otherwise.

(psq-ref psq key)

psq-ref : psq key -> priority returns the priority of a key if it is in the priority search queue. If the key is not in the priority queue an error is raised.

(psq-set psq key priority)

psq-set : psq key priority -> psq returns the priority search queue obtained from inserting a key with a given priority. If the key is already in the priority search queue, it updates the priority to the new value.

(psq-update psq key f default)

psq-update : psq key (priority -> priority) priority -> psq returns the priority search queue obtained by modifying the priority of key, by the given function. If the key is not in the priority search queue, it is inserted with the priority obtained by calling the function on the default value.

(psq-delete psq key)

psq-delete : psq key -> psq returns the priority search queue obtained by removing the key-priority association from the priority search queue. If the key is not in the queue, then the returned search queue will be the same as the original.

(psq-contains? psq key)

psq-contains? : psq key -> boolean returns #t if there is an association for the given key in the priority search queue, #f otherwise.

(psq-min psq)

psq-min : psq -> key returns the key of the minimum association in the priority search queue. If the queue is empty, an error is raised.

(psq-delete-min psq)

psq-delete-min : psq -> psq returns the priority search queue obtained by removing the minimum association in the priority search queue. If the queue is empty, an error is raised.

(psq-pop psq)

psq-pop : psq -> key + psq returns two values: the minimum key and the priority search queue obtained by removing the minimum association from the original queue. If the queue is empty, an error is raised.

(psq-at-most psq max-priority)

psq-at-most : psq priority -> ListOf(key . priority) returns an alist containing all the associations in the priority search queue with priority less than or equal to a given value. The alist returned is ordered by key according to the predicate for the psq.

(psq-at-most-range psq max-priority min-key max-key)

psq-at-most-range : psq priority key key -> ListOf(key . priority) Similar to psq-at-most, but it also takes an upper and lower bound, for the keys it will return. These bounds are inclusive.

(psq-size psq)

psq-size : psq -> non-negative integer returns the number of associations in the priority search queue