NAME

Nest - Nested Arrays


DESCRIPTION

The message system for Karma caches header information in a nested tree, or multidementional array. Unfortunately this isn't easy to accomplish in perl, and requires much trickery.

Below is a sketch from the early development stages. please excuse the lack of detail.

        sample tree:
        post /
                reply
                reply/
                        reply/
                                reply
        post

proposed array structure for the reply tree:

    @threads = ( 
                        [ post, reply, [ reply, [ reply, reply ] ] ],
                        [ post ], 
                ) ;

in this example each element of the array contains a reference to another array which, in turn, contains actual article numbers as well as references to more such arrays.

        example 2 - accessing the data
        $threads[0][0] == post
        $threads[0][1] ==       reply
     $threads[0][2][0] ==       reply
  $threads[0][2][1][0] ==               reply
  $threads[0][2][1][1] ==                       reply   
        $threads[1][0] == post
        when the tree is flattened it becomes a numbered list, like so.

        $threads[0] == [1, post ]
        $threads[1] == [1.1,    reply ]
        $threads[2] == [1.2,    reply ]
        $threads[3] == [1.2.1,          reply ]
        $threads[4] == [1.2.1.1,                reply ]
        $threads[5] == [2, post ]