YAP 7.1.0
Non-Backtrackable Data Structures

The following routines implement well-known data-structures using global non-backtrackable variables (implemented on the Prolog stack) More...

Detailed Description

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 Documentation

◆ nb_beam/2

class nb_beam/2

nb_beam(+ DefaultSize,- Beam)

Create a Beam with default size DefaultSize Note that size is fixed throughout

◆ nb_beam_add/3

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

◆ nb_beam_close/1

class nb_beam_close/1

nb_beam_close(+ Beam)

Close the beam Beam: no further elements can be added

◆ nb_beam_del/3

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

◆ nb_beam_empty/1

class nb_beam_empty/1

nb_beam_empty(+ Beam)

Succeeds if Beam is empty

◆ nb_beam_peek/3

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

◆ nb_beam_size/2

class nb_beam_size/2

nb_beam_size(+ Beam, - Size)

Unify Size with the number of elements in the beam Beam

◆ nb_heap/2

class nb_heap/2

nb_heap(+ DefaultSize,- Heap)

Create a Heap with default size DefaultSize Note that size will expand as needed

◆ nb_heap_add/3

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

◆ nb_heap_close/1

class nb_heap_close/1

nb_heap_close(+ Heap)

Close the heap Heap: no further elements can be added

◆ nb_heap_del/3

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

◆ nb_heap_empty/1

class nb_heap_empty/1

nb_heap_empty(+ Heap)

Succeeds if Heap is empty

◆ nb_heap_peek/3

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

◆ nb_heap_size/2

class nb_heap_size/2

nb_heap_size(+ Heap, - Size)

Unify Size with the number of elements in the heap Heap

◆ nb_queue/1

class nb_queue/1

nb_queue(- Queue)

Create a Queue

◆ nb_queue_close/3

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

◆ nb_queue_dequeue/2

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

◆ nb_queue_empty/1

class nb_queue_empty/1

nb_queue_empty(+ Queue)

Succeeds if Queue is empty

◆ nb_queue_enqueue/2

class nb_queue_enqueue/2

nb_queue_enqueue(+ Queue, + Element)

Add Element to the front of the queue Queue

◆ nb_queue_peek/2

class nb_queue_peek/2

nb_queue_peek(+ Queue, - Element)

Element is the front of the queue Queue Fail if the queue is empty

◆ nb_queue_size/2

class nb_queue_size/2

nb_queue_size(+ Queue, - Size)

Unify Size with the number of elements in the queue Queue