1:- module(priorityq,
2 [ pq_insert/4
3 , pq_remove/4
4 , pq_size/2
5 , pq_peek/3
6 , pq_empty/1
7 ]).
12:- use_module(library(heaps)).
16pq_empty(H) :- empty_heap(H).
20pq_peek(P, V, H) :- min_of_heap(H,P1,V), P is -P1.
24pq_insert(P, V, H1, H2) :- P1 is -P, add_to_heap(H1, P1, V, H2).
28pq_remove(P, V, H1, H2) :- get_from_heap(H1, P1, V, H2), P is -P1.
32pq_size(H, N) :- heap_size(H, N)
Priority queues (thin wrapper for library(heaps)
*/