If someone does know stuff about implimenting trees in lisp could you also
describe a method to go from a list to a tree and vice versa.
thanks a mil
cj
--
C.J. Vergara, Jr., President [-->The Future Of The Web<--]
Aggressive Enterprises, Inc. | pager->1-800-365-6451 |
Box 751891 Dallas, Tx. 75275-1891 | email->···@aggressive.com |
http://www.aggressive.com/ | phone->214-797-1786 |
··@seas.smu.edu (Carlos Javier Vergara) writes:
>
>
> If someone does know stuff about implimenting trees in lisp could you also
> describe a method to go from a list to a tree and vice versa.
> thanks a mil
#+:shameless-plug
(In the AI repositor at CMU there are implementations for trees,
RB-trees and priority-queues built by the writer of this message |:)| )
In that implementation, you can simply say (given that 'a-tree' is
your tree.)
(let ((result ()))
(traverse a-tree #'(lambda (node-content) (push node-content result))
:inorder)
result)
As a matter of fact this is a good implementation of 'map-tree' :)
Cheers :)
--
Marco Antoniotti - Resistente Umano
===============================================================================
International Computer Science Institute | ·······@icsi.berkeley.edu
1947 Center STR, Suite 600 | tel. +1 (510) 643 9153
Berkeley, CA, 94704-1198, USA | +1 (510) 642 4274 x149