(defn filter-collecting [predicate collector & lists]
  (for [v (apply map vector lists) :when (apply predicate v)] (apply
collector v)))

On Fri, Aug 14, 2009 at 10:22 PM, Jarkko Oranen <chous...@gmail.com> wrote:

>
>
>
> On Aug 14, 10:51 pm, Sean Devlin <francoisdev...@gmail.com> wrote:
> > I'd start with you usage docs
> >
> > ;; usage:
> > ;; (filter-collecting
> > ;;   (fn [x y] (< x y))
> > ;;   (fn [x y] (+ x y))
> > ;;   [1 7 3 9]
> > ;;   [5 5 5 5])
> > ;;  ==> (6 8)
>
> ;; usage:
> ;; (filter-collecting < +
> ;;   [1 7 3 9]
> ;;   [5 5 5 5])
> ;;  ==> (6 8)
>
> (defn filter-collecting [c f & seqs]
>  (remove nil?
>    (apply map (fn [& args] (when (apply c args)
>                                           (apply f args)))
>                       seqs)))
>
> --
> Jarkko
> >
>


-- 
Professional: http://cgrand.net/ (fr)
On Clojure: http://clj-me.blogspot.com/ (en)

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

Reply via email to