Looks good to me. I wasn't familiar with the docs around (seq x) vs (not (empty? x)). That seems like a good place to draw the language from.
-kb On Tue, Jun 14, 2011 at 1:43 PM, Ambrose Bonnaire-Sergeant < abonnaireserge...@gmail.com> wrote: > Inspired by "seq"/"empty?" docstrings. > > not-any? > > Returns false if (pred x) is logical true for any x in coll, > else true - same as (not (some pred coll)). > > > some > > Returns the first logical true value of (pred x) for any x in coll, > else nil. One common idiom is to use a set as pred, for example > this will return :fred if :fred is in the sequence, otherwise nil: > (some #{:fred} coll) > Please use the idiom (not-any? pred coll) rather than (not (some pred > coll)) > > Thoughts? > > Ambrose > > On Wed, Jun 15, 2011 at 2:31 AM, Kevin Baribeau > <kevin.barib...@gmail.com>wrote: > >> I actually had the same thought as the OP when reading through docs not >> too long ago. >> >> +1 for adding a pointer to "some" in the docstring of "not-any?" >> >> -kb >> >> On Tue, Jun 14, 2011 at 11:29 AM, Ambrose Bonnaire-Sergeant < >> abonnaireserge...@gmail.com> wrote: >> >>> Hi David, >>> >>> any? would be redundant and less general than some, if I am not mistaken. >>> Compare the docstrings for the hypothetical "any?". >>> >>> (some p coll) >>> Returns the *first logical true value* of (pred x) for any x in coll, >>> else *nil*. >>> >>> (any? p coll) >>> Returns *true* if (pred x) is logical true for any x in coll, >>> else *false*. >>> >>> >>> Since *nil* and *false* are both falsy, "some" can be used as a >>> predicate that is truthy >>> when it finds truthy result, otherwise falsy. This is exactly the >>> behavior expected from >>> an any? function. >>> >>> "some" is a poster boy for Clojure's well thought out truthyness system, >>> this is a great example >>> of the types of general functions it allows. >>> >>> Perhaps a pointer to "some" should be added in the docstring of >>> "not-any?". Although >>> a quick look at the source makes it crystal clear. I wasn't aware of >>> "not-any?"s existence, >>> maybe noting it in "some"s docstring could be beneficial also. >>> >>> Thanks, >>> Ambrose >>> >>> On Tue, Jun 14, 2011 at 3:08 PM, de1976 <davidescobar1...@gmail.com>wrote: >>> >>>> Hello everyone. In looking through the API documentation, I've noticed >>>> that there is a "not-any?" function available, but there is no >>>> corresponding inverse "any?" function that I can find. There are, >>>> however, "every?" and "not-every?" functions available. The closest I >>>> could find was "some", but wouldn't it make sense to have an "any?" >>>> function for more obvious consistency? Thanks. >>>> >>>> -- >>>> 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 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 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 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 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