protocol
heapp
ï
Heap protocol. Key-value pairs are represented as Key-Value
.
Availability:
logtalk_load(heaps(loader))
Author: Richard OâKeefe; adapted to Logtalk by Paulo Moura and Victor Lagerkvist.
Version: 1:0:1
Date: 2010-11-13
Compilation flags:
static
Dependencies:
(none)
Remarks:
(none)
Inherited public predicates:
(none)
Public predicatesï
insert/4
ï
Inserts the new pair into a heap, returning the updated heap.
Compilation flags:
static
Template:
insert(Key,Value,Heap,NewHeap)
Mode and number of proofs:
insert(+key,+value,+heap,-heap)
- one
insert_all/3
ï
Inserts a list of pairs into a heap, returning the updated heap.
Compilation flags:
static
Template:
insert_all(List,Heap,NewHeap)
Mode and number of proofs:
insert_all(@list(pairs),+heap,-heap)
- one
delete/4
ï
Deletes and returns the top pair in a heap returning the updated heap.
Compilation flags:
static
Template:
delete(Heap,TopKey,TopValue,NewHeap)
Mode and number of proofs:
delete(+heap,?key,?value,-heap)
- zero_or_one
merge/3
ï
Merges two heaps.
Compilation flags:
static
Template:
merge(Heap1,Heap2,NewHeap)
Mode and number of proofs:
merge(+heap,+heap,-heap)
- one
empty/1
ï
True if the heap is empty.
Compilation flags:
static
Template:
empty(Heap)
Mode and number of proofs:
empty(@heap)
- zero_or_one
size/2
ï
Returns the number of heap elements.
Compilation flags:
static
Template:
size(Heap,Size)
Mode and number of proofs:
size(+heap,?integer)
- zero_or_one
as_list/2
ï
Returns the current set of pairs in the heap as a list, sorted into ascending order of the keys.
Compilation flags:
static
Template:
as_list(Heap,List)
Mode and number of proofs:
as_list(+heap,-list)
- one
as_heap/2
ï
Constructs a heap from a list of pairs.
Compilation flags:
static
Template:
as_heap(List,Heap)
Mode and number of proofs:
as_heap(+list,-heap)
- one
top/3
ï
Returns the top pair in the heap. Fails if the heap is empty.
Compilation flags:
static
Template:
top(Heap,TopKey,TopValue)
Mode and number of proofs:
top(+heap,?key,?value)
- zero_or_one
top_next/5
ï
Returns the top pair and the next pair in the heap. Fails if the heap does not have at least two elements.
Compilation flags:
static
Template:
top_next(Heap,TopKey,TopValue,NextKey,NextValue)
Mode and number of proofs:
top_next(+heap,?key,?value,?key,?value)
- zero_or_one
Protected predicatesï
(none)
Private predicatesï
(none)
Operatorsï
(none)
See also