Re: tree-utils

2009-05-16 Thread kyle smith
Sounds good. Unless there are other suggestions, can someone make the minor changes and commit it to contrib? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: tree-utils

2009-05-14 Thread Jarkko Oranen
> Recursively summing all the elements in a tree: > user=>(tree-apply #(reduce + %) true true atree) > 28 > user=>(tree-apply #(reduce + %) true true btree) > 34 > > I think these are generally useful, so I'm just looking for some > feedback and possible inclusion in contrib.  Thanks! Please do

Re: tree-utils

2009-05-14 Thread Konrad Hinsen
On 14.05.2009, at 09:22, Laurent PETIT wrote: > Isn't tree-reduce similar to clojure.contrib.generic.functor/fmap > (though fmap preserves the type of the structure, while your > function returns seqs of seqs ...) ? fmap is not recursive. When given a list, it would only act at the top lev

Re: tree-utils

2009-05-14 Thread Laurent PETIT
Hi, Isn't tree-reduce similar to clojure.contrib.generic.functor/fmap (though fmap preserves the type of the structure, while your function returns seqs of seqs ...) ? (Ah, and I find that the name reduce here is a bit misleading, since the operation really does a mapping from a tree to another ?

tree-utils

2009-05-13 Thread kyle smith
I've uploaded tree-utils.clj to the files section. http://groups.google.com/group/clojure/web/tree-utils.clj Here are some example usages: Subtracting two (or more) trees element-by-element: user=> atree [[1 2] [3 4 5] [6 7]] user=> btree [[2 3] [4 5 6] [7 8]] user=> (tree-reduce - atree btree)