Re: Code improvement: searching a tree

2009-10-24 Thread samppi
Jeez, that's amazing. Thanks a lot; I had no idea that trees-seq existed. I keep getting surprised by Clojure. On Oct 24, 2:05 pm, James Reeves wrote: > This is a slightly faster and somewhat shorter version: > > (defn find-dependencies2 >   [rel-rep] >   (set (filter symbol? (tree-seq seq? rest

Re: Code improvement: searching a tree

2009-10-24 Thread James Reeves
This is a slightly faster and somewhat shorter version: (defn find-dependencies2 [rel-rep] (set (filter symbol? (tree-seq seq? rest rel-rep - James On Oct 24, 9:55 pm, samppi wrote: > I suspect the code below can be improved. The function returns the set > of all symbols inside a list-

Code improvement: searching a tree

2009-10-24 Thread samppi
I suspect the code below can be improved. The function returns the set of all symbols inside a list-tree that are not at the beginning of a list. Is there a way to make the code more compact or faster? (with-test (defn- find-dependencies [rel-rep] (cond (list? rel-rep) (le