Am Donnerstag, 15. September 2011 schrieb Ken Wesson : > On Thu, Sep 15, 2011 at 8:56 AM, Herwig Hochleitner > <hhochleit...@gmail.com <javascript:;>> wrote: > > Consider > > > > (defn find-in-tree > > ([tree pred?] > > (concat > > (filter pred? tree) > > (mapcat find-in-tree (filter sequential? tree) (repeat pred?))))) > > > > which of course is much simpler written as > > > > (defn find-in-tree > > ([tree pred?] (filter pred? (flatten tree)))) > > Not quite -- these differ in the case where pred? sometimes fires for > a subtree and not just for leaves. The latter will miss all the > subtrees for which pred? returns logical true. >
ack > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. > > -- > 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<javascript:;> > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com <javascript:;> > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en -- __________________________________________________________________ Herwig Hochleitner -- 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 Note that posts from new members are moderated - please be patient with your first post. 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