Re: What is the structure of a namespace
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
Re: What is the structure of a namespace
On Fri, Apr 16, 2021 at 02:12:08PM -0500, polifemo wrote: > So, I have another question: Is the 'pico tree namespace built the same way > as any namespace of any 'loaded file? like, (load '@lib/simul.l) populates > the 'simul symbol with the names defined inside the '@lib/simul.l file. Is > the process for creating the 'simul namespace the same as creating the > 'pico namespace? 'pico' is a bit special, because it is created at compile time. But it is simply a cons pair of two trees, like any other namespace. Namespaces which are created at runtime (with the 'symbols' function) are identical. The namespace for transient symabol is like 'pico' hard-compiled into the binary, and the namespace for external symbols too (though the latter is only a single tree because external (DB) symbols have only short names). ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: What is the structure of a namespace
ok, I kinda see. So, I have another question: Is the 'pico tree namespace built the same way as any namespace of any 'loaded file? like, (load '@lib/simul.l) populates the 'simul symbol with the names defined inside the '@lib/simul.l file. Is the process for creating the 'simul namespace the same as creating the 'pico namespace? And how is the namespace of a loaded file created? On Fri, Apr 16, 2021 at 2:01 PM Alexander Burger wrote: > Hi polifemo, > > > I've realized that the 'pico namespace is a tree, but I can't figure out > > which kind of tree. It does not seem fit with a binary tree structure. > > > > So, what's the structure of namespaces, and what's the algorithm for > > organizing the symbols inside a namespace list? > > You are very close :) > > In fact, it is a cons-pair of *two* binary trees: One for symbols with > names of > 7 or less bytes (so that the name is a short number), and one for symbols > with > longer names (name is a bignum). > > ☺/ A!ex > > > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe >
Re: What is the structure of a namespace
Hi polifemo, > I've realized that the 'pico namespace is a tree, but I can't figure out > which kind of tree. It does not seem fit with a binary tree structure. > > So, what's the structure of namespaces, and what's the algorithm for > organizing the symbols inside a namespace list? You are very close :) In fact, it is a cons-pair of *two* binary trees: One for symbols with names of 7 or less bytes (so that the name is a short number), and one for symbols with longer names (name is a bignum). ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
What is the structure of a namespace
I've realized that the 'pico namespace is a tree, but I can't figure out which kind of tree. It does not seem fit with a binary tree structure. So, what's the structure of namespaces, and what's the algorithm for organizing the symbols inside a namespace list?
LLVM 12
hi, new stable LLVM version released this night. pil21 passed all tests. BTW, llvm-nightly aka LLVM13 works too. p.s. If you have code which works and generates strange result do not hesitate post it here and ask. No open issues so far. (mike) -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: Why do waitFd and gPoll use 292MY for timeout?
$ picolisp -wait [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775807] [fds=0x0][nfds=0][timeout=9223372036854775806] !? (wait) Select error: Invalid argument ? : (wait) !? (wait) Select error: Invalid argument ? : (wait) !? (wait) Select error: Invalid argument ? fds was NULL, but then became non-NULL. -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe