Hi, This is another puzzle/exercise based on a very practical need. I could not find a built in function, hoping something like "colfn" already exists. Otherwise I wonder about an idiomatic solution. This is self-explanatory code:
user=> (require '[clojure.algo.generic.functor :as fu]) user=> (require '[me.raynes.fs :as fs]) user=> (defn colfn[col] (fn [a] (fu/fmap #(% a) col))) user=> (map (colfn [fs/directory?,identity]) (filter fs/directory?(set (fs/list-dir ".")))) ([true "src"] [true "target"] [true ".git"]) user=> (map (colfn {:is-dir fs/directory?, :dir identity}) (filter fs/directory?(set (fs/list-dir ".")))) ({:is-dir true, :dir "src"} {:is-dir true, :dir "target"} {:is-dir true, :dir ".git"}) My question is, if something like colfn already exists? The idea is to generate a function of a sequence (vector, list, map) of functions which would used in e.g. map. Best, Andy -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.