Here's an approach that doesn't use macros. I'm not sure I'd actually
do this, but here it is just for grins.
(defn bind [pred]
(fn [[x bool]] [x (and (pred x) bool)]))
(defn comp# [ & preds ]
(let [ phi (reduce comp (map bind preds))]
(fn [x] (second (phi [x true])))))
user> (filter (comp# even? pos? #(zero? (rem % 3)) ) (range -30 30))
(6 12 18 24)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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