![]() |
YAP 7.1.0
|
The following routines implement well-known data-structures using global non-backtrackable variables (implemented on the Prolog stack) More...
The following routines implement well-known data-structures using global non-backtrackable variables (implemented on the Prolog stack)
The data-structures currently supported are Queues, Heaps, and Beam for Beam search They are allowed through library(nb)
class nb_beam/2 |
nb_beam(+ DefaultSize,- Beam)
Create a Beam with default size DefaultSize Note that size is fixed throughout
class nb_beam_add/3 |
nb_beam_add(+ Beam, + Key, + Value)
Add Key- Value to the beam Beam The key is sorted on Key only
class nb_beam_close/1 |
nb_beam_close(+ Beam)
Close the beam Beam: no further elements can be added
class nb_beam_del/3 |
nb_beam_del(+ Beam, - Key, - Value)
Remove element Key- Value with smallest Value in beam Beam Fail if the beam is empty
class nb_beam_empty/1 |
nb_beam_empty(+ Beam)
Succeeds if Beam is empty
class nb_beam_peek/3 |
nb_beam_peek(+ Beam, - Key, - Value)
)
Key- Value is the element with smallest Key in the beam Beam Fail if the beam is empty
class nb_beam_size/2 |
nb_beam_size(+ Beam, - Size)
Unify Size with the number of elements in the beam Beam
class nb_heap/2 |
nb_heap(+ DefaultSize,- Heap)
Create a Heap with default size DefaultSize Note that size will expand as needed
class nb_heap_add/3 |
nb_heap_add(+ Heap, + Key, + Value)
Add Key- Value to the heap Heap The key is sorted on Key only
class nb_heap_close/1 |
nb_heap_close(+ Heap)
Close the heap Heap: no further elements can be added
class nb_heap_del/3 |
nb_heap_del(+ Heap, - Key, - Value)
Remove element Key- Value with smallest Value in heap Heap Fail if the heap is empty
class nb_heap_empty/1 |
nb_heap_empty(+ Heap)
Succeeds if Heap is empty
class nb_heap_peek/3 |
nb_heap_peek(+ Heap, - Key, - Value)
)
Key- Value is the element with smallest Key in the heap Heap Fail if the heap is empty
class nb_heap_size/2 |
nb_heap_size(+ Heap, - Size)
Unify Size with the number of elements in the heap Heap
class nb_queue/1 |
nb_queue(- Queue)
Create a Queue
class nb_queue_close/3 |
nb_queue_close(+ Queue, - Head, ? Tail)
Unify the queue Queue with a difference list Head- Tail The queue will now be empty and no further elements can be added
class nb_queue_dequeue/2 |
nb_queue_dequeue(+ Queue, - Element)
Remove Element from the front of the queue Queue Fail if the queue is empty
class nb_queue_empty/1 |
nb_queue_empty(+ Queue)
Succeeds if Queue is empty
class nb_queue_enqueue/2 |
nb_queue_enqueue(+ Queue, + Element)
Add Element to the front of the queue Queue
class nb_queue_peek/2 |
nb_queue_peek(+ Queue, - Element)
Element is the front of the queue Queue Fail if the queue is empty
class nb_queue_size/2 |
nb_queue_size(+ Queue, - Size)
Unify Size with the number of elements in the queue Queue