7.6.3 Vector trees

Prev Up Next Page 193 of 800 Search internet

A vector tree is a data structure built up from vectors and pairs. A vector tree represents the concatenation of all vectors in the tree. As an example, !"abc" :: !"d" :: !"ef" represents !"abcdef".

The vt2vector ( x ) function converts a vector tree to a vector:

vt2vector ( !"abc" :: !"d" :: !"ef" ) == !"abcdef"

In particular, a vector is a vector tree:

vt2vector ( !"abc" ) == !"abc"

In the vector tree representation, all structures which are not pairs or vectors are ignored:

vt2vector ( << !"abc" ,, false ,, - 1 ,, !"def" >> ) == !"abcdef"

As a consequence of the latter, all data structures are vector trees, but quite many data structures represent the empty string.

Vector trees have the nice property that they make it easy and cpu-fast to construct a text from pieces. Furthermore, vector trees are easy to print to a terminal or write to a disk file. For that reason, many Logiweb output functions are constructed such that they accept vector trees as their arguments.

Prev Up Next Page 193 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05