> 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 away with those two boolean arguments in tree-apply; I think
it'd be immeasurably better to take a set of options ar an argument...
Boolean parameters harm readability.
I suggest something like (tree-apply #{:only-coll :recursive} #(reduce
+ %) btree) with a an overload for the situation where no options are
supplied.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---