Re: What's the function that returns the opposite of a predicate?

2009-04-30 Thread samppi

Wonderful. I didn't think of searching for "opposite". Thanks
everyone.

On Apr 30, 11:25 am, "Stephen C. Gilardi"  wrote:
> On Apr 30, 2009, at 1:50 PM, samppi wrote:
>
> > I know there's a core function that takes a predicate and returns its
> > opposite:
>
> > (defn mystery [predicate]
> > (fn [x] (not (predicate x
>
> > I'm having a lot of trouble finding the name of it in the docs,
> > though. Could anyone give me its name? Or does this function not exist
> > in the core?
>
> Is this the one you're thinking of?
>
> user=> (find-doc "opposite")
> -
> clojure.core/complement
> ([f])
>   Takes a fn f and returns a fn that takes the same arguments as f,
>   has the same effects, if any, and returns the opposite truth value.
> nil
> user=>
>
> --Steve
>
>  smime.p7s
> 3KViewDownload
--~--~-~--~~~---~--~~
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
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
-~--~~~~--~~--~--~---



Re: What's the function that returns the opposite of a predicate?

2009-04-30 Thread Stephen C. Gilardi


On Apr 30, 2009, at 1:50 PM, samppi wrote:


I know there's a core function that takes a predicate and returns its
opposite:

(defn mystery [predicate]
(fn [x] (not (predicate x

I'm having a lot of trouble finding the name of it in the docs,
though. Could anyone give me its name? Or does this function not exist
in the core?



Is this the one you're thinking of?

user=> (find-doc "opposite")
-
clojure.core/complement
([f])
 Takes a fn f and returns a fn that takes the same arguments as f,
 has the same effects, if any, and returns the opposite truth value.
nil
user=>

--Steve



smime.p7s
Description: S/MIME cryptographic signature


Re: What's the function that returns the opposite of a predicate?

2009-04-30 Thread Parth Malwankar

On Thu, 30 Apr 2009 23:20:14 +0530, samppi  wrote:

>
> I know there's a core function that takes a predicate and returns its
> opposite:
>
> (defn mystery [predicate]
>   (fn [x] (not (predicate x
>
> I'm having a lot of trouble finding the name of it in the docs,
> though. Could anyone give me its name? Or does this function not exist
> in the core?

user=> (doc complement)
-
clojure.core/complement
([f])
   Takes a fn f and returns a fn that takes the same arguments as f,
   has the same effects, if any, and returns the opposite truth value.
nil
user=>

Regards,
Parth


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



Re: What's the function that returns the opposite of a predicate?

2009-04-30 Thread Andrew Wagner
I think maybe you want complement: http://clojure.org/api#complement

On Thu, Apr 30, 2009 at 1:50 PM, samppi  wrote:

>
> I know there's a core function that takes a predicate and returns its
> opposite:
>
> (defn mystery [predicate]
>  (fn [x] (not (predicate x
>
> I'm having a lot of trouble finding the name of it in the docs,
> though. Could anyone give me its name? Or does this function not exist
> in the core?
> >
>

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



What's the function that returns the opposite of a predicate?

2009-04-30 Thread samppi

I know there's a core function that takes a predicate and returns its
opposite:

(defn mystery [predicate]
  (fn [x] (not (predicate x

I'm having a lot of trouble finding the name of it in the docs,
though. Could anyone give me its name? Or does this function not exist
in the core?
--~--~-~--~~~---~--~~
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
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
-~--~~~~--~~--~--~---