On Feb 3, 10:41 pm, wlr <geeked...@gmail.com> wrote:
> Can you somehow use ->> ?
>
> user> (->> #{1 2 3 4} (clojure.set/select even?))
> #{2 4}

D'oh, I was terribly unclear. I want to do something neat and pretty
like:

;; Doesn't work!
(-> #{{:a 1, :b 1, :c 1}
      {:a 2, :b 2, :c 2}
      {:a 3, :b 3, :c 3}}
    (select  #(= (:a %) 1))
    (project [:b :c]))


Unfortunately, that doesn't work -- select expects the relations as
the second param, while project wants it as the first. I can do this,
but it's not so neat:

;; Works, but is ugly.
(let [xset  #{{:a 1, :b 1, :c 1}
              {:a 2, :b 2, :c 2}
              {:a 3, :b 3, :c 3}}]
  (project (select #(= (:a %) 1) xset)
           [:b :c]))


So what I currently do is this:

;; Works, with a little blemish.
(-> #{{:a 1, :b 1, :c 1}
      {:a 2, :b 2, :c 2}
      {:a 3, :b 3, :c 3}}
    ((revargs select) #(= (:a %) 1))
    (project          [:b :c]))


And I'm curious whether there's a better way.


Thanks,
Tayssir

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