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 ?)

Regards,

-- 
Laurent

2009/5/14 kyle smith <the1physic...@gmail.com>

>
> 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)
> ((-1 -1) (-1 -1 -1) (-1 -1))


>
> 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!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to