OH! I think I'm getting it!
for example, 'simul is '(\~ ("permute" ("shuffle" ("flood" ("G" NIL "gen"
("DX" NIL "DY" ("FX") "FY" NIL "Col") "game" ("grid" ("Grid")) "west"
("east" ("East" ("disp")) "West")) "south" ("north" NIL "South") "border"))
"subsets" ("samples")))

Something that confused me was that first symbol, '\~. It is not a valid
picolisp symbol! But now that I see that a namespace is a cons of a "short
name namespace" and a "long name namespace", no symbol from either
namespace would be a reasonable root for the tree. So that arbitrary symbol
(\~) was chosen as the root. The cadr of 'simul are the short names, and
there is no caddr because there are no long names!

One of the things that confused me was the way trees are represented. For
example, given this tree:

         9
      8
   7
      6
5
         4
      3
   2
      1

I would have represented it as a nested list in this way:
(5 (2 (1 NIL NIL) (3 NIL (4 NIL NIL))) (7 (6 NIL NIL) (8 NIL (9 NIL NIL))))
That is, each new branch is inside its own list. Intuitive, but quite
wasteful, given that conses are memory in picolisp.

But the picolisp way is:
(5 (2 (1) 3 NIL 4) 7 (6) 8 NIL 9)
this is hard for me to describe, but something like...
Every second element is the left branch of the element before it, and every
third element is the right branch of the element two places back.

Its a wonderfully ingenious compression, and much easier to read than my
naive implementation of trees. Just that, without that description I just
gave, it was really hard for me to understand it.

Without that description, I could not see namespaces as binary trees at
all! XD
I'm publishing this as a small documentation for anyone confused about this

Reply via email to