Re: Growing trees

2009-01-28 Thread Timothy Pratley
Thanks :) That works great. I wrote a simple math precedence parser based upon it: http://github.com/timothypratley/strive/blob/195c350485a7f01c7ddef01a85d1fd4fc1652fd9/src/clj/math-tree.clj Test expression [1 + 2 * 3 ^ 4 + 5 * 6] (+ 1 (* 2 (^ 3 4)) (* 5 6)) Regards, Tim --~--~-~--~~

Re: Growing trees

2009-01-28 Thread Christophe Grand
Christophe Grand a écrit : > Timothy Pratley a écrit : > >> I want to grow a tree programmatically so have been trying zippers: >> >> (defn insert-parent [loc n] >> (clojure.zip/replace loc (clojure.zip/make-node >> loc n loc))) >> (println (clojure.zip/root (inse

Re: Growing trees

2009-01-27 Thread Christophe Grand
Timothy Pratley a écrit : > I want to grow a tree programmatically so have been trying zippers: > > (defn insert-parent [loc n] > (clojure.zip/replace loc (clojure.zip/make-node > loc n loc))) > (println (clojure.zip/root (insert-parent (clojure.zip/seq-zip (list > 1