Hi,
Thanks a lot for hints. "remove" was what I needed.
This
(filter (complement #(apply = %)) '([1 2] [1 1]))
also looks very clean now.
Regards,
Andy
On Thu, Aug 21, 2014 at 1:07 PM, Daniel Solano Gómez <[email protected]>
wrote:
> On Thu Aug 21 13:01 2014, Andy C wrote:
> > 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 ?
>
> What about 'remove' instead of 'filter'?
>
> Sincerely,
>
> Daniel
>
> >
> > Thx,
> > Andy
> >
> > --
> > 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
> > ---
> > 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 [email protected].
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> 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
> ---
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
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
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.