nnt - Generic n-Tree

Module Description

The nnt module implements a n-Tree that can store variable size nodes. It is the base module for more specialised trees, for example the cel n-tree [nct]. Due to the structure of a n-tree the words for changing the tree, adding and removing children, are part of the iterator [nni].

Module Words

Tree structure

nnt% ( -- n )
Get the required space for a nnt variable

Tree creation, initialisation and destruction

nnt-init ( nnt -- )
Initialise the n-tree

nnt-(free) ( xt nnt -- )
Free all nodes in the tree with xt

nnt-create ( "<spaces>name" -- ; -- nnt )
Create a named n-tree in the dictionary

nnt-new ( -- nnt )
Create a new n-tree on the heap

nnt-free ( nnt -- )
Free the tree from the heap

Member words

nnt-length@ ( nnt -- u )
Get the number of nodes in the tree

nnt-empty? ( nnt -- flag )
Check for an empty tree

nnt-root@ ( nnt -- nnn | nil )
Get the root of the tree

Tree words

nnt-execute ( i*x xt nnt -- j*x )
Execute xt for every node in tree

nnt-execute? ( i*x xt nnt -- j*x flag )
Execute xt for every node in the tree until xt returns true

Inspection

nnt-dump ( nnt -- )
Dump the tree


generated 10-Apr-2008 by ofcfrth-0.5.0