Hi,

I have used the idx function a few times and enjoyed it, but it had never 
occurred to me, until I took a closer look at the Rosettacode Word_count 
example, that I could also store values at the symbols in an idx tree. Wow! ;-) 
I’m quite impressed by the speed of that PicoLisp Word_count example.

http://rosettacode.org/wiki/Word_count#PicoLisp

At first I thought that the word count values were stored in the very idx tree 
structure, but then I thought maybe not. I did a test with two trees B and C 
and made separate functions to register words in B and C:

(de aB (W) (if (idx 'B W T) (inc (car @)) (set W 1)))
(de aC (W) (if (idx 'C W T) (inc (car @)) (set W 1)))

I then did a couple of (aB 'foo) and then (aC 'foo), and noticed that the use 
of aC interferred with the values registered by aB. I think one would need 
separate name spaces for aB and aC if one should need to count words in two 
separate trees at the same time. Maybe the Rosettacode Word_count example 
should be updated with its own name space. As it is right now, it’s a bit 
quick-and-dirty.

/Jon

Reply via email to