::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
class Gilda.Container.Public &Containers included in the Basis library.
public Gilda
:
:...............................................................................
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::: Heap procedures ::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::: Heap(string) :::::::::::::::::::::::::::::::::::
:
sequence HEAP..Heap..string pure: Scan a Heap from the bottom up.
entry Heap Heap..string, &Heap to scan
Start = 0 word :First element to access; 0 is the bottom
exit *Element string :At each element on the Heap
:
:...............................................................................
:
function INDEX..Heap..Heap..string: Index to the next element up the Heap.
entry ~Heap..Heap..string :Iterator
exit Count word :Number of elements yielded so far
:
:...............................................................................
:
function IS.LAST..Heap..Heap..string: See if this is the last element in a Heap.
entry ~Heap..Heap..string :Iterator
exit Last Bit :Set if the last element.
:
: Note: Call within a loop to check for the final iteration.
:...............................................................................
:
method PRIOR..Heap..Heap..string pure: Reposition to the next lower element in an open iteration.
change ~Heap..Heap..string :Iterator
exit *Prior string :At the next lower element; 0 if none below or done
:
:...............................................................................
:
method SUSPEND..Heap..Heap..string pure: Save the index to the next element up and terminate.
change ~Heap..Heap..string :Iterator
exit Count word :Number of elements yielded so far
:
:...............................................................................
:
method MOVE..Heap..Heap..string pure: Reset the index to the next element to yield.
change ~Heap..Heap..string :Iterator
entry Next word :Index to the next element to yield
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Heap..string pure: Remove elements from the top to bottom of a Heap.
change Heap..string :Heap to deplete
exit *Element string :At each element in the Heap
:
:...............................................................................
:
method PILE..Heap..string pure: Add an element on top of a Heap.
change Heap..string :Heap to append
entry Value string :Value copied into the new element
:
:...............................................................................
:
method PILE.AT..Heap..string pure: Allocate a clean element on top of a Heap.
change Heap..string :Heap to append
exit *Element string :At the allocated element
:
:...............................................................................
:
function HEAD..Heap..string: Copy the top element in a Heap.
entry Heap..string :Heap to access
exit Value string :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Heap.
.
:...............................................................................
:
function HEAD.AT..Heap..string: Reference the top element in a Heap.
entry Heap..string :Heap to access
exit *Element string :At the element on the top; @0 if empty
:
:...............................................................................
:
function TAIL..Heap..string: Copy the bottom element in a Heap.
entry Heap..string :Heap to access
exit Value string :Value copied from the bottom element
precondition
$Size fault; Cannot get the bottom element of an empty Heap.
.
:...............................................................................
:
function TAIL.AT..Heap..string: Reference the bottom element in a Heap.
entry Heap..string :Heap to access
exit *Element string :At the element on the bottom; @0 if empty
:
:...............................................................................
:
function PEEK..Heap..string: Copy an indexed element from a Heap.
entry Heap..string, &Heap to access
Index = 0 word :Element to access; 0 is the bottom
exit Value string :Value copied from the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function PEEK.AT..Heap..string: Reference an indexed element in a Heap.
entry Heap..string, &Heap to access
Index = 0 word :Element to access; @0 is the bottom
exit *Element string :At the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function FIND..Heap..string: Scan a Heap bottom up for a value and return its index.
entry Heap..string, &Heap to be scanned
Value string :Value to be found
exit Index word :0 based Index from the bottom; -1 if not found
:
:...............................................................................
:
function FIND.AT..Heap..string: Scan a Heap for a value and return the element if present.
entry Heap..string, &Heap to be scanned
Value string :Value to be found
exit *Element string :At the first element found; @0 if not found
:
:...............................................................................
:
method REMOVE..Heap..string pure: Remove elements from the top of a Heap.
change Heap..string :Heap containing element to remove
entry Count = 1 word :Number of elements to remove; may be zero
precondition
$Size or Remove = 0 fault; Cannot remove elements from an empty Heap.
Remove _<= $Size fault; Tried to remove too many elements from a Heap.
.
:...............................................................................
:
method STORE..Heap..string pure: Copy a value into an existing Heap element.
change Heap..string :Heap to update
entry Index word, &Index of the element, zero-based
Value string :Value to store in the selected element
:
:...............................................................................
:
method EMPTY..Heap..string pure: Remove all elements in a Heap.
change Heap..string :Heap to empty
:
:...............................................................................
:
method DRAIN..Heap..string pure: Free resources used by a Heap.
change Heap..string :Heap to drain
:
:...............................................................................
:::::::::::::::::::::::::::::: Heap(word) ::::::::::::::::::::::::::::::::::::
:
sequence HEAP..Heap..word pure: Scan a Heap from the bottom up.
entry Heap Heap..word, &Heap to scan
Start = 0 word :First element to access; 0 is the bottom
exit *Element word :At each element on the Heap
:
:...............................................................................
:
function INDEX..Heap..Heap..word: Index to the next element up the Heap.
entry ~Heap..Heap..word :Iterator
exit Count word :Number of elements yielded so far
:
:...............................................................................
:
function IS.LAST..Heap..Heap..word: See if this is the last element in a Heap.
entry ~Heap..Heap..word :Iterator
exit Last Bit :Set if the last element.
:
:...............................................................................
:
method PRIOR..Heap..Heap..word pure: Reposition to the next lower element in an open iteration.
change ~Heap..Heap..word :Iterator
exit *Prior word :At the next lower element; 0 if none below or done
:
:...............................................................................
:
method SUSPEND..Heap..Heap..word pure: Save the index to the next element up and terminate.
change ~Heap..Heap..word :Iterator
exit Index word :Number of elements yielded so far
:
:...............................................................................
:
method MOVE..Heap..Heap..word pure: Reset the index to the next element to yield.
change ~Heap..Heap..word :Iterator
entry Next word :Index to the next element to yield
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Heap..word pure: Remove elements from the top to bottom of a Heap.
change Heap..word :Heap to deplete
exit *Element word :At each element in the Heap
:
:...............................................................................
:
method PILE..Heap..word pure: Add an element on top of a Heap.
change Heap..word :Heap to append
entry Value word :Value copied to the new element
:
:...............................................................................
:
method PILE.AT..Heap..word pure: Allocate a clean element on top of a Heap.
change Heap..word :Heap to append
exit *Element word :At the allocated element
:
:...............................................................................
:
function HEAD..Heap..word: Copy the top element on a Heap.
entry Heap..word :Heap to access
exit Value word :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Heap.
.
:...............................................................................
:
function HEAD.AT..Heap..word: Reference the top element on a Heap
entry Heap..word :Heap to access
exit *Element word :At the element on the top; @0 if empty
:
:...............................................................................
:
function TAIL..Heap..word: Copy the bottom element on a Heap.
entry Heap..word :Heap to access
exit Value word :Value copied from the bottom element
precondition
$Size fault; Cannot get the bottom element of an empty Heap.
.
:...............................................................................
:
function TAIL.AT..Heap..word: Reference the bottom element of a Heap.
entry Heap..word :Heap to access
exit *Element word :At the element on the bottom; @0 if empty
:
:...............................................................................
:
function PEEK..Heap..word: Copy an element from the bottom of a Heap.
entry Heap..word, &Heap to access
Index = 0 word :Element to access; 0 is the bottom
exit Value word :Value copied from the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function PEEK.AT..Heap..word: Reference an indexed element in a Heap.
entry Heap..word, &Heap to access
Index = 0 word :Element to access; 0 is the bottom
exit *Element word :At the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function FIND..Heap..word: Scan a Heap bottom up for a value and return its index.
entry Heap..word, &Heap to be scanned
Value word :Value to be found
exit Index word :0 based Index to the first element found; -1 if not found
:
:...............................................................................
:
function FIND.AT..Heap..word: Scan a Heap for a value and return the element if present.
entry Heap..word, &Heap to be scanned
Value word :Value to be found
exit *Element word :At the first element found; @0 if not found
:
:...............................................................................
:
method REMOVE..Heap..word pure: Remove elements from the top of a Heap.
change Heap..word :Heap containing element to remove
entry Remove = 1 word :Number of elements to remove; may be zero
precondition
$Size or Remove = 0 fault; Cannot remove elements from an empty Heap.
Remove _<= $Size fault; Tried to remove too many elements from a Heap.
.
:...............................................................................
:
method STORE..Heap..word pure: Shallow copy into an existing Heap element.
change Heap..word :Heap to update
entry Index word, &Index of the element, zero-based
Value word :Value to store in the selected element
:
:...............................................................................
:
method EMPTY..Heap..word pure: Remove all elements in a Heap.
change Heap..word :Heap to empty
:
:...............................................................................
:
method DRAIN..Heap..word pure: Free resources used by a Heap.
change Heap..word :Heap to drain
:
:...............................................................................
:::::::::::::::::::::::::::::: Heap(cell) ::::::::::::::::::::::::::::::::::::
:
sequence HEAP..Heap..cell pure: Scan a Heap from the bottom up.
entry Heap Heap..cell, &Heap to scan
Start = 0 word :First element to access; 0 is the bottom
exit *Element cell :At each element on the Heap
:
:...............................................................................
:
function INDEX..Heap..Heap..cell: Index to the next element up the Heap.
entry ~Heap..Heap..cell :Iterator
exit Count word :Number of elements yielded so far
:
:...............................................................................
:
function IS.LAST..Heap..Heap..cell: See if this is the last element in a Heap.
entry ~Heap..Heap..cell :Iterator
exit Last Bit :Set if the last element.
:
:...............................................................................
:
method PRIOR..Heap..Heap..cell pure: Reposition to the next lower element in an open iteration.
change ~Heap..Heap..cell :Iterator
exit *Prior cell :At the next lower element; 0 if none below or done
:
:...............................................................................
:
method SUSPEND..Heap..Heap..cell pure: Save the index to the next element up and terminate.
change ~Heap..Heap..cell :Iterator
exit Count word :Number of elements yielded so far
:
:...............................................................................
:
method MOVE..Heap..Heap..cell pure: Reset the index to the next element to yield.
change ~Heap..Heap..cell :Iterator
entry Next word :Index to the next element to yield
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Heap..cell pure: Remove elements from the top to bottom of a Heap.
change Heap..cell :Heap to deplete
exit *Element cell :At each element in the Heap
:
:...............................................................................
:
method PILE..Heap..cell pure: Add an element on top of a Heap.
change Heap..cell :Heap to append
entry Value cell :Value copied to the new element
:
:...............................................................................
:
method PILE.AT..Heap..cell pure: Allocate a clean element on top of a Heap.
change Heap..cell :Heap to append
exit *Element cell :At the allocated element
:
:...............................................................................
:
function HEAD..Heap..cell: Copy the top element of a Heap.
entry Heap..cell :Heap to access
exit Value cell :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Heap.
.
:...............................................................................
:
function HEAD.AT..Heap..cell: Reference the top element on a Heap
entry Heap..cell :Heap to access
exit *Element cell :At the element on the top; @0 if empty
:
:...............................................................................
:
function TAIL..Heap..cell: Copy the bottom element on a Heap.
entry Heap..cell :Heap to access
exit Value cell :Value copied from the bottom element
precondition
$Size fault; Cannot get the bottom element of an empty Heap.
.
:...............................................................................
:
function TAIL.AT..Heap..cell: Reference the bottom element on a Heap.
entry Heap..cell :Heap to access
exit *Element cell :At the element on the bottom; @0 if empty
:
:...............................................................................
:
function PEEK..Heap..cell: Copy an indexed element from in a Heap.
entry Heap..cell, &Heap to access
Index = 0 word :Element to access; 0 is the bottom
exit Value cell :Value copied from the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function PEEK.AT..Heap..cell: Reference an element in a Heap.
entry Heap..cell, &Heap to access
Index = 0 word :Element to access; 0 is the bottom
exit *Element cell :At the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function FIND..Heap..cell: Scan a Heap bottom up for a value and return its index.
entry Heap..cell, &Heap to be scanned
Value cell :Value to be found
exit Index word :0 based Index to the first element found; -1 if not found
:
:...............................................................................
:
function FIND.AT..Heap..cell: Scan a Heap for a value and return the element if present.
entry Heap..cell, &Heap to be scanned
Value cell :Value to be found
exit *Element cell :At the first element found; @0 if not found
:
:...............................................................................
:
method REMOVE..Heap..cell pure: Remove elements from the top of a Heap.
change Heap..cell :Heap containing element to remove
entry Remove = 1 word :Number of elements to remove; may be zero
precondition
$Size or Remove = 0 fault; Cannot remove elements from an empty Heap.
Remove _<= $Size fault; Tried to remove too many elements from a Heap.
.
:...............................................................................
:
method STORE..Heap..cell pure: Shallow copy into an existing Heap element.
change Heap..cell :Heap to update
entry Index word, &Index of the element, zero-based
Value cell :Value to store in the selected element
:
:...............................................................................
:
method EMPTY..Heap..cell pure: Remove all elements in a Heap.
change Heap..cell :Heap to empty
:
:...............................................................................
:
method DRAIN..Heap..cell pure: Free resources used by a Heap.
change Heap..cell :Heap to drain
:
:...............................................................................
:::::::::::::::::::::::::::::: Heap(byte) ::::::::::::::::::::::::::::::::::::
:
sequence HEAP..Heap..byte pure: Scan a Heap from the bottom up.
entry Heap Heap..byte, &Heap to scan
Start = 0 word :First element to access; 0 is the bottom
exit *Element byte :At each element on the Heap
:
:...............................................................................
:
function INDEX..Heap..Heap..byte: Index to the next element up the Heap.
entry ~Heap..Heap..byte :Iterator
exit Count word :Number of elements yielded so far
:
:...............................................................................
:
function IS.LAST..Heap..Heap..byte: See if this is the last element in a Heap.
entry ~Heap..Heap..byte :Iterator
exit Last Bit :Set if the last element.
:
:...............................................................................
:
method PRIOR..Heap..Heap..byte pure: Reposition to the next lower element in an open iteration.
change ~Heap..Heap..byte :Iterator
exit *Prior byte :At the next lower element; 0 if none below or done
:
:...............................................................................
:
method SUSPEND..Heap..Heap..byte pure: Save the index to the next element up and terminate.
change ~Heap..Heap..byte :Iterator
exit Index word :Number of elements yielded so far
:
:...............................................................................
:
method MOVE..Heap..Heap..byte pure: Reset the index to the next element to yield.
change ~Heap..Heap..byte :Iterator
entry Next word :Index to the next element to yield
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Heap..byte pure: Remove elements from the top to bottom of a Heap.
change Heap..byte :Heap to deplete
exit *Element byte :At each element in the Heap
:
:...............................................................................
:
method PILE..Heap..byte pure: Add an element on top of a Heap.
change Heap..byte :Heap to append
entry Value byte :Value copied into the new element
:
:...............................................................................
:
method PILE.AT..Heap..byte pure: Allocate a clean element on top of a Heap.
change Heap..byte :Heap to append
exit *Element byte :At the allocated element
:
:...............................................................................
:
function HEAD..Heap..byte: Copy the top element in a Heap.
entry Heap..byte :Heap to access
exit Value byte :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Heap.
.
:...............................................................................
:
function HEAD.AT..Heap..byte: Reference the top element in a Heap
entry Heap..byte :Heap to access
exit *Element byte :At the element on the top; @0 if empty
:
:...............................................................................
:
function TAIL..Heap..byte: Copy the bottom element in a Heap.
entry Heap..byte :Heap to access
exit Value byte :Value copied from the bottom element
precondition
$Size fault; Cannot get the bottom element of an empty Heap.
.
:...............................................................................
:
function TAIL.AT..Heap..byte: Reference the bottom element on a Heap.
entry Heap..byte :Heap to access
exit *Element byte :At the bottom element; @0 if empty
:
:...............................................................................
:
function PEEK..Heap..byte: Copy an indexed element from the bottom of a Heap.
entry Heap..byte, &Heap to access
Index = 0 word :Element to access; 0 is the bottom
exit Value byte :Value copied from the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function PEEK.AT..Heap..byte: Reference an indexed element in a Heap.
entry Heap..byte, &Heap to access
Index = 0 word :Element to access; 0 is the bottom
exit *Element byte :At the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function FIND..Heap..byte: Scan a Heap bottom up for a value and return its index.
entry Heap..byte, &Heap to be scanned
Value byte :Value to be found
exit Index word :0 based Index from the bottom; -1 if not found
:
:...............................................................................
:
function FIND.AT..Heap..byte: Scan a Heap for a value and return the element if present.
entry Heap..byte, &Heap to be scanned
Value byte :Value to be found
exit *Element byte :At the first element found; @0 if not found
:
:...............................................................................
:
method REMOVE..Heap..byte pure: Remove elements from the top of a Heap.
change Heap..byte :Heap containing element to remove
entry Remove = 1 byte :Number of elements to remove; may be zero
precondition
$Size or Remove = 0 fault; Cannot remove elements from an empty Heap.
Remove _<= $Size fault; Tried to remove too many elements from a Heap.
.
:...............................................................................
:
method STORE..Heap..byte pure: Shallow copy into an existing Heap element.
change Heap..byte :Heap to update
entry Index word, &Index of the element, zero-based
Value byte :Value to store in the selected element
:
:...............................................................................
:
method EMPTY..Heap..byte pure: Remove all elements in a Heap.
change Heap..byte :Heap to empty
:
:...............................................................................
:
method DRAIN..Heap..byte pure: Free resources used by a Heap.
change Heap..byte :Heap to drain
:
:...............................................................................
::::::::::::::::::::::::::: Heap(Key..word) ::::::::::::::::::::::::::::::::::
:
sequence HEAP..Heap..Key..word pure: Scan a Heap from the bottom up.
entry Heap Heap..Key..word, &Heap to scan
Start = 0 word :First element to access; 0 is the bottom
exit *Element Key..word :At each element on the Heap
:
:...............................................................................
:
function INDEX..Heap..Heap..Key..word: Index to the next element up the Heap.
entry ~Heap..Heap..Key..word :Iterator
exit Count word :Number of elements yielded so far
:
:...............................................................................
:
function IS.LAST..Heap..Heap..Key..word: See if this is the last element in a Heap.
entry ~Heap..Heap..Key..word :Iterator
exit Last Bit :Set if the last element.
:
:...............................................................................
:
method PRIOR..Heap..Heap..Key..word pure: Reposition to the next lower element in an open iteration.
change ~Heap..Heap..Key..word :Iterator
exit *Prior Key..word :At the next lower element; 0 if none below or done
:
:...............................................................................
:
method SUSPEND..Heap..Heap..Key..word pure: Save the index to the next element up and terminate.
change ~Heap..Heap..Key..word :Iterator
exit Count word :Number of elements yielded so far
:
:...............................................................................
:
method MOVE..Heap..Heap..Key..word pure: Reset the index to the next element to yield.
change ~Heap..Heap..Key..word :Iterator
entry Next word :Index to the next element to yield
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Heap..Key..word pure: Remove elements from the top to bottom of a Heap.
change Heap..Key..word :Heap to deplete
exit *Element Key..word :At each element in the Heap
:
:...............................................................................
:
method PILE..Heap..Key..word pure: Add an element on top of a Heap.
change Heap..Key..word :Heap to append
entry Value Key..word :Element value to copy
:
:...............................................................................
:
method PILE.AT..Heap..Key..word pure: Allocate a clean element on top of a Heap.
change Heap..Key..word :Heap to append
exit *Element Key..word :At the allocated element
:
:...............................................................................
:
function HEAD..Heap..Key..word: Copy the top element on a Heap.
entry Heap..Key..word :Heap to access
exit Value Key..word :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Heap.
.
:...............................................................................
:
function HEAD.AT..Heap..Key..word: Reference the top element on a Heap
entry Heap..Key..word :Heap to access
exit *Element Key..word :At the element on the top; @0 if empty
:
:...............................................................................
:
function TAIL..Heap..Key..word: Copy the bottom element on a Heap.
entry Heap..Key..word :Heap to access
exit Value Key..word :Value copied from the bottom element
precondition
$Size fault; Cannot get the bottom element of an empty Heap.
.
:...............................................................................
:
function TAIL.AT..Heap..Key..word: Reference the bottom element on a Heap.
entry Heap..Key..word :Heap to access
exit *Element Key..word :At the element on the bottom; @0 if empty
:
:...............................................................................
:
function PEEK..Heap..Key..word: Copy an element from the bottom of a Heap.
entry Heap..Key..word, &Heap to access
Index = 0 word :Element to access; 0 is the bottom
exit Value Key..word :Value copied from the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function PEEK.AT..Heap..Key..word: Access an element from the bottom of a Heap.
entry Heap..Key..word, &Heap to access
Index = 0 word :Element to access; 0 is the bottom
exit *Element Key..word :At the selected element
precondition
$Size fault; Cannot peek into an empty Heap.
Index _< $Size fault Index; Cannot peek with an index above a Heap.
.
:...............................................................................
:
function FIND..Heap..Key..word: Scan a Heap bottom up for a value and return its index.
entry Heap..Key..word, &Heap to be scanned
Value Key..word :Value to be found
exit Index word :0 based Index from the bottom; -1 if not found
:
:...............................................................................
:
function FIND.AT..Heap..Key..word: Scan a Heap for a value and return the element if present.
entry Heap..Key..word, &Heap to be scanned
Value Key..word :Value to be found
exit *Element Key..word :At the first element found; @0 if not found
:
:...............................................................................
:
method STORE..Heap..Key..word pure: Shallow copy into an existing Heap element.
change Heap..Key..word :Heap to update
entry Index word, &Index of the element, zero-based
Value Key..word :Value to store in the selected element
:
:...............................................................................
:
method REMOVE..Heap..Key..word pure: Remove elements from the top of a Heap.
change Heap..Key..word :Heap containing element to remove
entry Remove = 1 word :Number of elements to remove; may be zero
precondition
$Size or Remove = 0 fault; Cannot remove elements from an empty Heap.
Remove _<= $Size fault; Tried to remove too many elements from a Heap.
.
:...............................................................................
:
method EMPTY..Heap..Key..word pure: Remove all elements in a Heap.
change Heap..Key..word :Heap to empty
:
:...............................................................................
:
method DRAIN..Heap..Key..word pure: Free resources used by a Heap.
change Heap..Key..word :Heap to drain
:
:...............................................................................
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::: Stack procedures ::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::: Stack(string) :::::::::::::::::::::::::::::::::::
:
sequence STACK..Stack..string pure: Scan a Stack from the top down.
entry Stack..string, &Stack to scan
Index = 0 word :First element to access; 0 is the top
exit *Element string :At each element on the Stack
:
:...............................................................................
:
method SUSPEND..Stack..Stack..string: Save the index to the next element down the Stack.
change ~Stack..Stack..string :Iterator
exit Count word :Number of values yielded so far
:
:...............................................................................
:
function IS.LAST..Stack..string: See if the sequence has returned it's last value.
entry ~Stack..Stack..string :Iterator
exit Last Bit :Set if the sequence has no more values.
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Stack..string pure: Remove elements from the top to bottom of a Stack.
change Stack..Stack..string :Stack to deplete
exit *Element string :At each element in the Stack
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
method PUSH..Stack..string pure: Add an element to the top of a Stack.
change Stack..string :Stack to prepend
entry Value string :Value to copy into the new element
:
:...............................................................................
:
method PUSH.AT..Stack..string pure: Allocate a clean element on top of a Stack.
change Stack..string :Stack to prepend
exit *Element string :At the allocated element
:
:...............................................................................
:
method POP..Stack..string pure: Copy the top element in a Stack then remove it.
change Stack..string :Stack to pop
exit Value string :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
method POP.AT..Stack..string pure: Remove the top element and access the next top element in a Stack .
change Stack..string :Stack to pop
exit *Element string :At the next top element; @0 if no next element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
method HEAD..Stack..string pure: Copy the top element on a Stack.
entry Stack..string :Stack to access
exit Value string :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
function HEAD.AT..Stack..string: Reference the top element in a Stack.
entry Stack..string :Stack to access
exit *Element string :At the element on the top; @0 if empty
:
:...............................................................................
:
function PEEK..Stack..string: Copy an indexed element in a Stack.
entry Stack..string, &Stack to access
Index = 0 word :Element to access; 0 is the top
exit Value string :Value copied from the selected element
precondition
$Size fault; Cannot peek into an empty Stack.
Index _< $Size fault Index; Cannot peek with an index above a Stack.
.
:...............................................................................
:
function PEEK.AT..Stack..string: Reference an indexed element in a Stack.
entry Stack..string, &Stack to access
Index = 0 word :Element to access; 0 is the top
exit *Element string :At the selected element
precondition
$Size fault; Cannot peek into an empty Stack.
Index _< $Size fault Index; Cannot peek with an index below a Stack.
.
:...............................................................................
:
function FIND..Stack..string: Determine if a value is in a Stack in linear time.
entry Stack..string, &Stack to be scanned
Value string :Value to be found
exit Index word :0 based Index from the top; -1 if not found
:
:...............................................................................
:
method STORE..Stack..string pure: Copy a value into an existing Stack element.
change Stack..string :Stack to update
entry Index = 0 word, &Index of the element; 0 is the top
Value string :Value to copy into the selected element
:
:...............................................................................
:
method REMOVE..Stack..string pure: Remove elements from the top of a Stack.
change Stack..string :Stack containing element to remove
entry Remove = 1 word :Number of elements to remove; may be zero
precondition
$Size or Remove = 0 fault; Cannot remove elements from an empty Stack.
Remove _<= $Size fault; Tried to remove too may elements from a Stack.
.
:...............................................................................
:
method EMPTY..Stack..string pure: Remove all elements in a Stack.
change Stack..string :Stack to empty
:
:...............................................................................
:
method DRAIN..Stack..string pure: Free resources used by a Stack.
change Stack..string :Stack to drain
:
:...............................................................................
:::::::::::::::::::::::::::: Stack(word) :::::::::::::::::::::::::::::::::::::
:
sequence STACK..Stack..word pure: Scan a Stack from the top down.
entry Stack..word, &Stack to scan
Index = 0 word :First element to access; 0 is the top
exit *Element word :At each element on the Stack
:
:...............................................................................
:
method SUSPEND..Stack..Stack..word: Save the index to the next element down the Stack.
change ~Stack..Stack..word :Iterator
exit Index word :Number of values yielded so far.
:
:...............................................................................
:
function IS.LAST..Stack..word: See if the sequence has returned it's last value.
entry ~Stack..Stack..word :Iterator
exit Last Bit :Set if the sequence has no more values.
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Stack..word pure: Remove elements from the top to bottom of a Stack.
change Stack..Stack..word :Stack to deplete
exit *Element word :At each element in the Stack
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
method PUSH..Stack..word pure: Add an element to the top of a Stack.
change Stack..word :Stack to prepend
entry Value word :Value to copy into the new element
:
:...............................................................................
:
method PUSH.AT..Stack..word pure: Allocate a clean element on top of a Stack.
change Stack..word :Stack to prepend
exit *Element word :At the allocated element
:
:...............................................................................
:
method POP..Stack..word pure: Copy the top element in a Stack then remove it.
change Stack..word :Stack to pop
exit Value word :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
method POP.AT..Stack..word pure: Remove the top element and access the next top element in a Stack .
change Stack..word :Stack to pop
exit *Element word :At the next top element; @0 if no next element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
method HEAD..Stack..word pure: Copy the top element on a Stack.
entry Stack..word :Stack to access
exit Value word :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
function HEAD.AT..Stack..word: Refernce the top element in a Stack.
entry Stack..word :Stack to access
exit *Element word :At the element on the top; @0 if empty
:
:...............................................................................
:
function PEEK..Stack..word: Copy an indexed Stack element.
entry Stack..word, &Stack to access
Index = 0 word :Element to access; 0 is the top
exit Value word :Value copied from the selected element
precondition
$Size fault; Cannot peek into an empty Stack.
Index _< $Size fault Index; Cannot peek with an index below a Stack.
.
:...............................................................................
:
function PEEK.AT..Stack..word: Reference an indexed Stack element.
entry Stack..word, &Stack to access
Index = 0 word :Element to access; 0 is the top
exit *Element word :At the selected element
precondition
$Size fault; Cannot peek into an empty Stack.
Index _< $Size fault Index; Cannot peek with an index below a Stack.
.
:...............................................................................
:
function FIND..Stack..word: Determine if a value is in a Stack in linear time.
entry Stack..word, &Stack to be scanned
Value word :Value to be found
exit Index word :0 based Index from the top; -1 if not found
:
:...............................................................................
:
method STORE..Stack..word pure: Copy a value into an existing Stack element.
change Stack..word :Stack to update
entry Index = 0 word, &Index of the element; 0 is the top
Value word :Value to copy into the selected element
:
:...............................................................................
:
method REMOVE..Stack..word pure: Remove elements from the top of a Stack.
change Stack..word :Stack containing element to remove
entry Remove = 1 word :Number of elements to remove; may be zero
precondition
$Size or Remove = 0 fault; Cannot remove elements from an empty Stack.
Remove _<= $Size fault; Tried to remove too may elements from a Stack.
.
:...............................................................................
:
method EMPTY..Stack..word pure: Remove all elements in a Stack.
change Stack..word :Stack to empty
:
:...............................................................................
:
method DRAIN..Stack..word pure: Free resources used by a Stack.
change Stack..word :Stack to drain
:
:...............................................................................
:::::::::::::::::::::::::::: Stack(cell) :::::::::::::::::::::::::::::::::::::
:
sequence STACK..Stack..cell pure: Scan a Stack from the top down.
entry Stack..cell, &Stack to scan
Index = 0 word :First element to access; 0 is the top
exit *Element cell :At each element on the Stack
:
:...............................................................................
:
method SUSPEND..Stack..Stack..cell: Save the index to the next element down the Stack.
change ~Stack..Stack..cell :Iterator
exit Count word :Number of values yielded so far.
:
:...............................................................................
:
function IS.LAST..Stack..cell: See if the sequence has returned it's last value.
entry ~Stack..Stack..cell :Iterator
exit Last Bit :Set if the sequence has no more values.
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Stack..cell pure: Remove elements from the top to bottom of a Stack.
change Stack..Stack..cell :Stack to deplete
exit *Element cell :At each element in the Stack
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
method PUSH..Stack..cell pure: Add an element on top of a Stack.
change Stack..cell :Stack to prepend
entry Value cell :Value to copy into the new element
:
:...............................................................................
:
method PUSH.AT..Stack..cell pure: Allocate a clean element on top of a Stack.
change Stack..cell :Stack to prepend
exit *Element cell :At the allocated element
:
:...............................................................................
:
method POP..Stack..cell pure: Copy the top element in a Stack then remove it.
change Stack..cell :Stack to pop
exit Value cell :Value copied from the top element
precondition
$Size fault; Cannot pop the top element of an empty Stack.
.
:...............................................................................
:
method POP.AT..Stack..cell pure: Remove the top element and reference the next top element in a Stack .
change Stack..cell :Stack to pop
exit *Element cell :At the next top element; @0 if no next element
precondition
$Size fault; Cannot pop the top element of an empty Stack.
.
:...............................................................................
:
method HEAD..Stack..cell pure: Copy the top element on a Stack.
entry Stack..cell :Stack to access
exit Value cell :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
function HEAD.AT..Stack..cell: Reference the top element in a Stack.
entry Stack..cell :Stack to access
exit *Element cell :At the element on the top; @0 if emptye
:
:...............................................................................
:
function PEEK..Stack..cell: Copy an indexed element in a Stack.
entry Stack..cell, &Stack to access
Index = 0 word :Element to access; 0 is the top
exit Value cell :Value copied from the selected element
precondition
$Size fault; Cannot peek into an empty Stack.
Index _< $Size fault Index; Cannot peek with an index below a Stack.
.
:...............................................................................
:
function PEEK.AT..Stack..cell: Reference an indexed Stack element.
entry Stack..cell, &Stack to access
Index = 0 word :Element to access; 0 is the top
exit *Element cell :At the selected element
precondition
$Size fault; Cannot peek into an empty Stack.
Index _< $Size fault Index; Cannot peek with an index below a Stack.
.
:...............................................................................
:
function FIND..Stack..cell: See if a value is in a Stack.
entry Stack..cell, &Stack to be scanned
Value cell :Value to be found
exit Index word :0 based Index from the top; -1 if not found
:
:...............................................................................
:
method STORE..Stack..cell pure: Copy a value into an existing Stack element.
change Stack..cell :Stack to update
entry Index = 0 word, &Index of the element; 0 is the top
Value cell :Value to copy into the selected element
:
:...............................................................................
:
method REMOVE..Stack..cell pure: Remove elements from the top of a Stack.
change Stack..cell :Stack containing element to remove
entry Remove = 1 word :Number of elements to remove; may be zero
precondition
$Size or Remove = 0 fault; Cannot remove elements from an empty Stack.
Remove _<= $Size fault; Tried to remove too may elements from a Stack.
.
:...............................................................................
:
method EMPTY..Stack..cell pure: Remove all elements in a Stack.
change Stack..cell :Stack to empty
:
:...............................................................................
:
method DRAIN..Stack..cell pure: Free resources used by a Stack.
change Stack..cell :Stack to drain
:
:...............................................................................
:::::::::::::::::::::::::::: Stack(byte) :::::::::::::::::::::::::::::::::::::
:
sequence STACK..Stack..byte pure: Scan a Stack from the top down.
entry Stack..byte, &Stack to scan
Index = 0 word :First element to access; 0 is the top
exit *Element byte :At each element on the Stack
:
:...............................................................................
:
method SUSPEND..Stack..Stack..byte: Save the index to the next element down the Stack.
change ~Stack..Stack..byte :Iterator
exit Count word :Number of values yielded so far
:
:...............................................................................
:
function IS.LAST..Stack..byte: See if the sequence has returned it's last value.
entry ~Stack..Stack..byte :Iterator
exit Last Bit :Set if the sequence has no more values.
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Stack..byte pure: Remove elements from the top to bottom of a Stack.
change Stack..Stack..byte :Stack to deplete
exit *Element byte :At each element in the Stack
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
method PUSH..Stack..byte pure: Add an element on top of a Stack.
change Stack..byte :Stack to prepend
entry Value byte :Value to copy into the new element
:
:...............................................................................
:
method PUSH.AT..Stack..byte pure: Allocate a clean element on top of a Stack.
change Stack..byte :Stack to prepend
exit *Element byte :At the allocated element
:
:...............................................................................
:
method POP..Stack..byte pure: Copy the top element in a Stack then remove it.
change Stack..byte :Stack to pop
exit Value byte :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
method POP.AT..Stack..byte pure: Remove the top element and access the next top element in a Stack .
change Stack..byte :Stack to pop
exit *Element byte :At the next top element; @0 if no next element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
method HEAD..Stack..byte pure: Copy the top element on a Stack.
entry Stack..byte :Stack to access
exit Value byte :Value copied from the top element
precondition
$Size fault; Cannot get the top element of an empty Stack.
.
:...............................................................................
:
function HEAD.AT..Stack..byte: Reference the top element in a Stack.
entry Stack..byte :Stack to access
exit *Element byte :At the element on the top; @0 if empty
:
:...............................................................................
:
function PEEK..Stack..byte: Copy an indexed element in a Stack.
entry Stack..byte, &Stack to access
Index = 0 word :Element to access; 0 is the top
exit Value byte :Value copied from the selected element
precondition
$Size fault; Cannot peek into an empty Stack.
Index _< $Size fault Index; Cannot peek with an index below a Stack.
.
:...............................................................................
:
function PEEK.AT..Stack..byte: Reference an indexed Stack element.
entry Stack..byte, &Stack to access
Index = 0 word :Element to access; 0 is the top
exit *Element byte :At the selected element
precondition
$Size fault; Cannot peek into an empty Stack.
Index _< $Size fault Index; Cannot peek with an index below a Stack.
.
:...............................................................................
:
function FIND..Stack..byte: Determine if a value is in a Stack (linear time).
entry Stack..byte, &Stack to be scanned
Value byte :Value to be found
exit Index word :0 based Index from the top; -1 if not found
:
:...............................................................................
:
method STORE..Stack..byte pure: Copy a value into an existing Stack element.
change Stack..byte :Stack to update
entry Index = 0 word, &Index of the element; 0 is the top
Value byte :Value to copy into the selected element
:
:...............................................................................
:
method REMOVE..Stack..byte pure: Remove elements from the top of a Stack.
change Stack..byte :Stack containing element to remove
entry Remove = 1 word :Number of elements to remove; may be zero
precondition
$Size or Remove = 0 fault; Cannot remove elements from an empty Stack.
Remove _<= $Size fault; Tried to remove too may elements from a Stack.
.
:...............................................................................
:
method EMPTY..Stack..byte pure: Remove all elements in a Stack.
change Stack..byte :Stack to empty
:
:...............................................................................
:
method DRAIN..Stack..byte pure: Free resources used by a Stack.
change Stack..byte :Stack to drain
:
:...............................................................................
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::: Queue procedures ::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::: Queue(string) ::::::::::::::::::::::::::::::::::
:
sequence QUEUE..Queue..string pure: Scan a Queue from front to back.
entry Queue..cell, &Queue to scan
Index = 0 word :First element to access; 0 is the front
exit *Element string :At each element in the Queue
:
:...............................................................................
:
method SUSPEND..Queue..Queue..string pure: Save the index to the next element.
change ~Queue..Queue..string :Iterator
exit Count word :Number of values yielded so far
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
sequence DEPLETE..Queue..string pure: Remove elements from the front of a Queue.
change Queue..string :Queue to deplete
exit *Item string :At each element in the Queue
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
method ENQUEUE..Queue..string pure: Add an element in back of a Queue.
change Queue..string :Queue to be appended
entry Value string :Value copied to the new element
:
:...............................................................................
:
method ENQUEUE.AT..Queue..string pure: Allocate a clean element in back of a Queue.
change Queue..string :Queue to be appended
exit *Element string :At the allocated element
:
:...............................................................................
:
method DEQUEUE..Queue..string pure: Remove an element from the front of a Queue.
change Queue..string :Queue to dequeue
exit Value string :Value copied from the front element
:
:...............................................................................
:
method DEQUEUE.AT..Queue..string pure: Remove the front element and reference the next.
change Queue..string :Queue to dequeue
exit *Element = 0 string :At the next element; 0 if no next element
:
:...............................................................................
:
method PUSH..Queue..string pure: Insert an element in the front of a Queue.
change Queue..string :Queue to prepend
entry Value string :Value to copy into the new element
:
:...............................................................................
:
method PUSH.AT..Queue..string pure: Allocate a clean element in front of a Queue.
change Queue..string :Queue to prepend
exit *Element string :At the allocated element
:
:...............................................................................
:
function HEAD..Queue..string: Copy the element from the front of a Queue.
entry Queue..string :Queue to access
exit Value string :Value copied from the front element
:
:...............................................................................
:
function HEAD.AT..Queue..string: Reference the front element in a Queue.
entry Queue..string :Queue to access
exit *Element string :At the front element; @0 if empty
:
:...............................................................................
:
function TAIL..Queue..string: Copy the element in the back of a Queue.
entry Queue..string :Queue to access
exit Value string :Value copied from the back element
:
:...............................................................................
:
function TAIL.AT..Queue..string: At the back element in a Queue.
entry Queue..string :Queue to access
exit *Element string :At the back element; @0 if an empty Queue
:
:...............................................................................
function PEEK..Queue..string: Copy an indexed element in a Queue.
entry Queue..string, &Queue to access
Index = 0 word :First element to access; 0 is at the front
exit Value string :Value copied from the selected element
precondition
$Front fault; Cannot peek into an empty Queue.
.
:...............................................................................
:
function PEEK.AT..Queue..string: Reference a Queue element by index.
entry Queue..string, &Queue to access
Index = 0 word :First element to access; 0 is at the front
exit *Element string :At the selected element
precondition
$Front fault; Cannot peek into an empty Queue.
.
:...............................................................................
:
function SIZE..Queue..string: Count the number of Queue elements.
entry Queue..string :Queue to measure
exit Size word :Number of elements in the Queue
:
:...............................................................................
:
function COUNT..Queue..string: Scan a Queue and count occurances of an item.
entry Queue..string, &Queue to scan
Value string :Value to count
exit Count = 0 word :Number of occurances
:
:...............................................................................
:
function FIND..Queue..string: See if an item is in a Queue.
entry Queue..string, &Queue to scan
Value string :Value to find
exit Find Bit :Set if the value is in the Queue
:
:...............................................................................
:
method STORE..string pure: Copy a value into an existing Queue element.
change Queue..string :Queue to update
entry Index = 0 word, &Number of elements in; 0 is at the front
Value string :Value to store in the selected element
:
:...............................................................................
:
method REMOVE..Queue..string pure: Remove elements from the front of of a virtual Queue .
change Queue..string :Queue containing element to remove
entry Count = 1 word :Number of elements to remove; may be zero
:
:...............................................................................
:
method EMPTY..Queue..string pure: Clear out an open type; leaving it open for more transactions.
change Queue..string :Queue to empty
:
:...............................................................................
:
method DRAIN..Queue..string pure: Reset a Queue to no elements.
change Queue..string :Queue to drain
:
:...............................................................................
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::: Vector procedures :::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::: Vector(string) ::::::::::::::::::::::::::::::::
:
method STORE..Vector..string pure: Store an element in a Vector.
change Vector..string :Vector to update
entry Index word, &Zero based index to an element
Value string :Value to copy into the selected element
:
:...............................................................................
:
method STORE.AT..Vector..string pure: Reference a Vector element by index and add it if new.
change Vector..string :Vector to update
entry Index word :Zero based index to an element
exit *Element string :At the selected element
:
:...............................................................................
:
function LOAD..Vector..string: Copy an element Value from a Vector.
entry Vector..string, &Vector to access
Index word :Zero based index to an element
exit Value string :Element value or a clean element when new
:
:...............................................................................
:
function LOAD.AT..Vector..string: Reference an exisitng element in a Vector.
entry Vector..string, &Vector to access
Index word :Zero based index to an element
exit *Element string :At the selected element or @0 if not set.
:
:...............................................................................
:
function SIZE..Vector..string: Get the maximum number of indexible elements.
entry Vector..string :Vector to access
exit Size cell :Number elements (maximum 2^32).
:
:...............................................................................
:
method EMPTY..Vector..string pure: Empty a Vector
change Vector..string :Vector to empty
:
:...............................................................................
:
method DRAIN..Vector..string pure: Drain a Vector
change Vector..string :Vector to drain
:
:...............................................................................
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::: Hash procedures :::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::: Hash(string, string) ::::::::::::::::::::::::::::::
:
sequence HASH..Hash..string pure: Scan each element in a Hash table.
entry Hash..string, &Hash table to scan
First = "" string :Key to start scanning; defaults to the first
exit *Element Key..string :Each element in the table
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
method PUT..Hash..string pure: Add a Key and value to a Hash table.
change Hash..string :Hash table to update
entry Key string, &Key to be added; overwrite existing
Tag string :Value copied into a new or exisitng element
:
:...............................................................................
:
method PUT.AT..Hash..string pure: Allocate and set an element in a Hash table.
change Hash..string :Hash table to update
entry Key string :Key to be added; may already exist
exit *Element Key..string, &At the new or existing element
New Bit :Set if the key was added; else already exists
:
:...............................................................................
:
function GET..Hash..string: Get the value for a key known to be present.
entry Hash..string, &Hash table to access
Key = "" string :A key to look up; defaults to the first
exit Tag string :Value associated with the key
:
: Fault if the element is not present.
:...............................................................................
:
function GET.AT..Hash..string: Look up a key in a Hash table.
entry Hash..string, &Hash table to access
Key = "" string :A key to look up; defaults to the first
exit *Element Key..string :At the selected element; @0 if not found
:
:...............................................................................
function ID..Hash..string: Form a unique id for a key in a Hash table.
entry Hash..string, &Hash table to access
Key = "" string :A name to look up; defaults to the first
exit Label string :Label of the form: n.m
:
: Fault if the element is not present.
:...............................................................................
:
method DELETE..Hash..string pure: Erase the element at the key.
change Hash..string :Hash table to update
entry Key string :A key to delete; ignored if not present
:
:...............................................................................
:
method EMPTY..Hash..string pure: Remove all elements in a Hash table.
change Hash..string :Hash table to empty
:
:...............................................................................
:
method DRAIN..Hash..string pure: Free resources used by a Hash table.
change Hash..string :Hash table to drain
:
:...............................................................................
:::::::::::::::::::::::::: Hash(string, word) ::::::::::::::::::::::::::::::::
:
sequence HASH..Hash..word pure: Scan an unordered Hash table of Keys.
entry Hash..word, &Hash table to scan
First = "" string :Default scans from the first Key
exit *Element Key..word :If found then scan from the value; else @0
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
method PUT..Hash..word pure: Add a Key and value to a Hash table.
change Hash..word :Hash table to update
entry Key string, &Key to be added; may already exist
Tag word :Value copied into a new or exisitng element
:
:...............................................................................
:
method PUT.AT..Hash..word pure: Allocate and set an element in a Hash table.
change Hash..word :Hash table to update
entry Key string :Key to be added; may already exist
exit *Element Key..word, &At the new or existing element
New Bit :Set if the key was added; else overwritten value
:
:...............................................................................
:
function GET..Hash..word: Get the value for a key known to be present.
entry Hash..word, &Hash table to access
Key string :A key to look up; defaults to the first
exit Tag word :Value associated with the key
:
: Fault if the element is not present.
:...............................................................................
:
function GET.AT..Hash..word: Look up a key in a Hash table.
entry Hash..word, &Hash table to access
Key string :A key to look up; defaults to the first
exit *Element Key..word :If found then at the value; else null.
:
:...............................................................................
:
function ID..Hash..word: Form a unique id for a key in a Hash table.
entry Hash..word, &Hash table to access
Key = "" string :A name to look up; defaults to the first
exit Label string :Label of the form: n.m
:
: Fault if the element is not present.
:...............................................................................
:
method DELETE..Hash..word pure: Erase the element at the key.
change Hash..word :Hash table to update
entry Key string :A key to delete; ignored if not present
:
:...............................................................................
:
method EMPTY..Hash..word pure: Remove all elements in a Hash table.
change Hash..word :Hash table to empty
:
:...............................................................................
:
method DRAIN..Hash..word pure: Free resources used by a Hash table.
change Hash..word :Hash table to drain
:
:...............................................................................
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::: Map procedures :::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::: Map(string) ::::::::::::::::::::::::::::::::
:
sequence MAP..Map..string pure: Scan each element in a Map table.
entry Map..string, &Map table to scan
Key = "" string :First key to scan; may partially match
exit *Element Key..string :Each element in the Map table
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
method ADD..Map..string: Add a key to a Map table without duplicates.
change Map..string :Map table to update
entry Key string, &Key name to add
Tag string :Value associated with the key
:
:...............................................................................
:
method PUT..Map..string pure: Add a Key and associated value to a Map table.
change Map..string :Map table to update
entry Key string, &Key to add; may already be in the Map table
Value string :Value copied into a new or exisitng element
:
:...............................................................................
:
method PUT.AT..Map..string pure: Allocate an element in a Map table.
change Map..string :Map table to update
entry Key string :Key to add; may already be in the Map table
exit *Element Key..string, &At the new or existing element
New Bit :Set if the key was added; else already exists
:
: The Tag field is clean if the element was added.
:...............................................................................
:
function GET..Map..string: Copy the Tag value from an element in a Map table.
entry Map..string, &Map table to access
Key = "" string :Key to look up; defaults to the first
exit Value string :Value associated with the key
:
: Fault if the Key is not in the Map table.
:...............................................................................
:
function GET.AT..Map..string: Look up a key in a Map table.
entry Map..string, &Map table to access
Key = "" string :Key to look up; defaults to the first
exit *Element Key..string &At the element; @0 if not found
:
:...............................................................................
:
method HEAD..Map..string pure: Get the alphabetically lowest element in a Map table.
change Map..string :Map table to update
exit Key string, &First key; @0 if an empty table
Tag string :Value associated with the Key
:
: Sets the current position to the lowest element.
: Fault if the Map table is empty.
:...............................................................................
:
method HEAD.AT..Map..string pure: Get the alphabetically lowest element in a Map table.
change Map..string :Map table to update
exit *Element Key..string :First element in the Map table; @0 if empty
:
: Sets the current position to the lowest element.
: Fault if the Map table is empty.
:...............................................................................
:
method NEXT..Map..string pure: Advance to the next element.
change Map..string :Map table to update
exit Key string, &Next key or empty if at the end of the Map table
Tag string :Value associated with the Key
:
:...............................................................................
:
method NEXT.AT..Map..string pure: Advance to the next element.
change Map..string :Map table to update
exit *Element Key..string :At the next element; @0 if at the end
:
:...............................................................................
:
function ITEM.AT..Map..string: Returns the current symbol in a table.
entry Map..string :Map table to access
exit *Element Key..string :At the current element; @0 if at the end
precondition
$Leaf ~= No.Sequence fault; Sequential access not initiated.
$Leaf ~= End.Of.Table fault; Advanced past the end of a table.
.
:...............................................................................
:
method FIND..Map..string pure: Look up a key in a Map table.
change Map..string :Map table to update
entry Key = "" string :The key must be present; defaults to the first
exit Tag string :Value copied from the element found
:
: Fault if the key was not found.
:...............................................................................
:
method FIND.AT..Map..string pure: Look up a key in a Map table.
change Map..string :Map table to update
entry Key = "" string :A key to look up; defaults to the first
exit *Element Key..string, &At the element found; @0 if not found
Exact Bit :Set if an exact match; else partial or a miss
:
:...............................................................................
:
method SCAN..Map..string pure: Find a key, partial key, or the next higher key.
change Map..string :Map table to scan
entry Key = "" string :A key to look up; defaults to the first
exit @Element Key..string, &Element with the Key or the next; @0 if no match
Exact Bit :Set if an exact match; else 0
:
:...............................................................................
:
method DELETE..Map..string pure: Remove a selected element in a Map table.
change Map..string :Map table to update
entry Key string :Element key to delete; ignored if not present
:
:...............................................................................
:
method EMPTY..Map..string pure: Empty a Map table.
change Map..string :Map table to empty
:
:...............................................................................
:
method DRAIN..Map..string pure: Drain a Map table.
change Map..string :Map table to drain
:
:...............................................................................
:::::::::::::::::::::::::::::: Map(word) :::::::::::::::::::::::::::::::::::::
:
sequence MAP..Map..word pure: Scan each element in a Map table.
entry Map..word, &Map table to scan
Key = "" string :First key to scan; may partially match
exit *Element Key..word :Each element in the Map table
:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:
method ADD..Map..word: Add a key to a Map table without duplicates.
change Map..word :Map table to update
entry Key string, &Key name to add
Tag word :Value associated with the key
:
:...............................................................................
:
method PUT..Map..word pure: Add a Key and associated value to a Map table.
change Map..word :Map table to update
entry Key string, &Key to add; may already be in the Map table
Value word :Value copied into a new or exisitng element
:
:...............................................................................
:
method PUT.AT..Map..word pure: Allocate an element in a Map table.
change Map..word :Map table to update
entry Key string :Key to add; may already be in the Map table
exit *Element Key..word, &At the new or existing element
New Bit :Set if the key was added; else already exists
:
: The Tag field is clean if the element was added.
:...............................................................................
:
function GET..Map..word: Copy the Tag value from an element in a Map table.
entry Map..word, &Map table to access
Key = "" string :Key to look up; defaults to the first
exit Value word :Value associated with the key
:
: Fault if the Key is not in the Map table.
:...............................................................................
:
function GET.AT..Map..word: Look up a key in a Map table.
entry Map..word, &Map table to access
Key = "" string :Key to look up; defaults to the first
exit *Element Key..word &At the element; @0 if not found
:
:...............................................................................
:
method HEAD..Map..word pure: Get the alphabetically lowest element in a Map table.
change Map..word :Map table to update
exit Key string, &First key; @0 if an empty table
Tag word :Value associated with the Key
:
: Sets the current position to the lowest element.
: Fault if the Map table is empty.
:...............................................................................
:
method HEAD.AT..Map..word pure: Get the alphabetically lowest element in a Map table.
change Map..word :Map table to update
exit *Element Key..word :First element in the Map table; @0 if empty
:
: Sets the current position to the lowest element.
: Fault if the Map table is empty.
:...............................................................................
:
method NEXT..Map..word pure: Advance to the next element.
change Map..word :Map table to update
exit Key string, &Next key or empty if at the end of the Map table
Tag word :Value associated with the Key
:
:...............................................................................
:
method NEXT.AT..Map..word pure: Advance to the next element.
change Map..word :Map table to update
exit *Element Key..word :At the next element; @0 if at the end
:
:...............................................................................
:
function ITEM.AT..Map..word: Returns the current symbol in a table.
entry Map..word :Map table to access
exit *Element Key..word :At the current element; @0 if at the end
precondition
$Leaf ~= No.Sequence fault; Sequential access not initiated.
$Leaf ~= End.Of.Table fault; Advanced past the end of a table.
.
:...............................................................................
:
method FIND..Map..word pure: Look up a key in a Map table.
change Map..word :Map table to update
entry Key = "" string :The key must be present; defaults to the first
exit Tag word :Value copied from the element found
:
: Fault if the key was not found.
:...............................................................................
:
method FIND.AT..Map..word pure: Look up a key in a Map table.
change Map..word :Map table to update
entry Key = "" string :A key to look up; defaults to the first
exit *Element Key..word, &At the element found; @0 if not found
Exact Bit :Set if an exact match; else partial or a miss
:
:...............................................................................
:
method SCAN..Map..word pure: Find a key, partial key, or the next higher key.
change Map..word :Map table to scan
entry Key = "" string :A key to look up; defaults to the first
exit *Element Key..word, &Element with the Key or the next; @0 if no match
Exact Bit :Set if an exact match; else 0
:
:...............................................................................
:
method DELETE..Map..word pure: Remove a selected element in a Map table.
change Map..word :Map table to update
entry Key string :Element key to delete; ignored if not present
:
:...............................................................................
:
method EMPTY..Map..word pure: Empty a Map table.
change Map..word :Map table to empty
:
:...............................................................................
:
method DRAIN..Map..word pure: Drain a Map table.
change Map..word :Map table to drain
:
:...............................................................................
end