I think you want complement, like (filter (complement odd?) ...)

Andy C <mailto:andy.coolw...@gmail.com>
August 21, 2014 at 2:01 PM
Hi,


I was wondering what is the nicest way to do filter-not in Clojure. Here are 3 expressions:

user=> (filter #(apply = %) '([1 2] [1 1]))
([1 1])
user=> (filter #(apply not= %) '([1 2] [1 1]))
([1 2])
user=> (filter #(not (apply = %)) '([1 2] [1 1]))
([1 2])


First one is just a base filtering. Second is taking advantage of having inverted predicate. Now let's assume that we have only a "positive" predicate, hence we would have to invert it by hand. That leads me to 3rd expression above.

I was wondering though is it is possible to somehow get "not" closer to "=", so the fact that we invert it is more obvious ...

Is it possible to do that? Or perhaps there is an easier way to code it up all together ?

Thx,
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 <mailto:clojure+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

--
Sam Ritchie (@sritchie)
Paddleguru Co-Founder
703.863.8561
www.paddleguru.com <http://www.paddleguru.com/>
Twitter <http://twitter.com/paddleguru>// Facebook <http://facebook.com/paddleguru>

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

Reply via email to