[cl-containers-devel] simple trees

Gary King gwking at metabang.com
Sun Feb 12 00:51:48 UTC 2006


Hi Attila,

Do you mean something that can store the data for an outline or a  
tree-control? What operations would be necessary for such a best. I  
can imagine:

(let ((outline (make-container 'outline)))
   (insert-item outline 'a)
   (insert-item outline 'b)
   (insert-item (item-at outline 'b) 'c)
   (insert-item (item-at outline 'b) 'd)
   (insert-item (item-at (item-at outline 'b) 'd)) 'e)
   (insert-item (item-at (item-at outline 'b) 'd)) 'f)
   ;; OR (insert-item (item-at outline 'b 'd) 'f)

   (insert-item outline 'g)
   outline)

which would make a data structure like this:

a
b - c
       d - e
             f
g

I think that the data structure would look like (ignoring much type  
information, etc).

(defclass* basic-outline ()
   (children))

(defclass* outline (basic-outline) ())

(defclass* outline-node (basic-outline)
  (parent))

size <outline> --> number of items in the outline (all the nodes,  
leaf or non-leaf)
insert-item / item-at
iterate / collect
etc.

Is this the sort of thing you are looking for?

regards,

On Feb 11, 2006, at 10:50 AM, Attila Lendvai wrote:

> hello all!
>
> i am looking for a simple tree implementation, something that suits
> the usual GUI needs (insertion ordered, parent navigation, any number
> for child nodes)
>
> does anyone have an implementation laying around?
>
> i've started to roll my own simple-tree into cl-containers, but it's
> not nicely integrating yet (well, and doesn't yet work at all). it
> needs much more work and therefore i tought i'll ask here in the hope
> that either someone have already done it or that Gary picks up the
> idea... :)
>
> thanks for any info, and for cl-containers of course!
>
> - attila
>
> (alias 101 on irc &no 'its not lisp code :)
> _______________________________________________
> cl-containers-devel mailing list
> cl-containers-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/cl-containers-devel


-- 
Gary Warren King
metabang.com
http://www.metabang.com/





More information about the cl-containers-devel mailing list