20040712 [CMcC]: I've written a [cost]-like tree editing language. The fundamental idea is to require of a tree-like object a simple API [http://sharedtech.dyndns.org/~colin/treecl/docs/treeapi.xml] and use that to generate and filter a list of nodes within the tree by using methods which map or apply methods and predicates to the nodes within the node set. The language form is very tcl-ish and quite free-form, which was entirely inspired by Cost. I should point out, in passing, that this approach is quite non-standard, and there are other more standard approaches to the problem of searching and editing trees, such as [tdom]. ---- I've put up some docs and a working version of TreeCL here: http://sharedtech.dyndns.org/~colin/treecl/docs/ - [CMcC] 20040813 Included with the library are a couple of adaptors, one to give file systems tree-semantics which gives file systems treecl/cost semantics. Beats the hell out of [[[glob]]] :) Another adaptor is doc, which uses parsehtml and the shallow xml parser to generate trees for scanning. I have to point out, however, this is very much a work in progress. ---- '''Some Examples''' from the included doc.tcl Create a doc given a URL: doc homepage -url http://sharedtech.dyndns.org/ Create a Costq query over the doc tree: Costq nh -tree homepage Print only the PCDATA content of the page: puts "TEXT: [nh query tree content]" Print the href attributes of all tags: puts "A: [nh query tree withtag a attval href]" Another way to do the same: puts "A2: [nh query tree hasatt href attval href]" Print the size of the tree: puts "SIZE: [homepage size]" ---- [Brian Theado] - 20040813 - Any chance you could package this up with all its dependencies in a starkit? I'd like to be able to do "source treecl.kit; package require costq". I tried to download and run it to try and understand better what it does and what it can be used for and stumbled because I don't have a recent enough tcllib (it appears to require struct packages that haven't been released and can only be found in CVS). I can get all the dependencies myself and right now I'm not going to take the time. [CMcC] 20040816 - Can I work on it a bit more before thinking about packaging? I'm not sure what is needed to starkitify it. I'm also looking at changing the file names a bit. [Brian Theado] Also, what is needed before executing the above code? Package require treecl? Package require costq? [CMcC] it's lifted from the doc.tcl program, which should be instructive in this matter, but which I haven't yet documented. [Brian Theado] For those interested in using this with tcllib's struct::tree, it appears that a small wrapper to convert the "rootname" method to "root" and add a "descendents" method, should do the trick. Am I right? [CMcC] I think that's so, Brian. I've ''tried'' to keep the interface as close as possible, but I may have erred. If someone would like to write the adaptor, I'd be happy to incorporate it. It might even work with struct::graph, and that would make a port to [e4graph] easier too.