At this moment after reading again this thread, I lost my sense of what false and true mean :) I'll now stick with maybe, it's much clearer...
Luc P. > On 23 May 2013 18:30, atkaaz <atk...@gmail.com> wrote: > > when you say the word "false" I'm assuming you're referring to "false?" the > > function (not "false" the boolean value), otherwise I don't understand > > I mean false-the-Boolean-value. > > To rephrase the point I was making previously, "(false x) is a truthy > value for any x in []" is a true sentence, indeed trivially so because > [] is empty. Thus (every? false []) returning true totally makes > sense. > > Of course, in Haskell any such expression would be ill-typed, and that > makes sense too -- in the context of that language. > > Opinions on the desired behaviour aside, in Clojure, implementing a > changed contract of every? whereby it would be required to throw when > passed something which cannot be treated as a predicate in the first > argument would be problematic -- checking that something is a function > is easy, but checking that a function has a useful unary overload is > not, in general. Well, you could simply try and call it with an > arbitrary object, but every? should be able to accept predicates which > it only makes sense to call on objects of a particular type, > predicates which have side effects, predicates which are expensive to > evaluate etc., so it's not an acceptable solution here. > > And going back to opinions again, note also that in any case the > result would still be to throw an exception at runtime. The current > behaviour is also to throw at runtime, except with empty collections. > So, assuming non-empty collections are the norm, we get an exception > either way -- would having the exception come from every? rather than > the attempt to call the not-really-a-predicate object be of much help > in debugging? > > Cheers, > M. > > > > > > so like: "What matters is that false? returns truthy values when called with > > any members of []" > > makes sense to me. > > > > So all I was saying above is that it should throw when [] is empty just as > > it does when [] is not empty, but it doesn't throw when empty because it's > > never called (by "it" i mean "false" not "false?") > > > > => (type false) > > java.lang.Boolean > > => (type false?) > > clojure.core$false_QMARK_ > > => (fn? false) > > false > > => (fn? false?) > > true > > > > But really, if you were not talking about "false?" then I don't get it (??) > > > > > > On Thu, May 23, 2013 at 4:48 PM, Michał Marczyk <michal.marc...@gmail.com> > > wrote: > >> > >> Whether (false 1) or (false true) is truthy is irrelevant. What > >> matters is that false returns truthy values when called with any > >> members of [], which is of course the case, as [] has no members. (For > >> it not to be the case, there would have to exist an x in [] for which > >> (false x) were not truthy -- clearly there is no such x.) > >> > >> This is the same story as with quantification restricted to the empty set: > >> > >> \forall x \in \emptyset . \phi(x) > >> > >> is true regardless of what \phi is, and intimately related to how > >> implication works in classical logic (since the above is shorthand for > >> a formula involving implication): > >> > >> x -> y > >> > >> is true when x is false, regardless of what value y takes. (It's also > >> true when y is true, regardless of what value x takes; this, however, > >> is not relevant here.) > >> > >> Cheers, > >> M. > >> > >> > >> On 23 May 2013 06:31, atkaaz <atk...@gmail.com> wrote: > >> > Well, seems to me more like this: > >> > if [] is empty then return true > >> > otherwise check (pred everyx in coll) > >> > however this allows for any pred especially(in this case) invalid preds: > >> > `false` is not a function/pred > >> > => (false 1) > >> > ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn > >> > cgws.notcore/eval2542 (NO_SOURCE_FILE:1) > >> > => (false true) > >> > ClassCastException java.lang.Boolean cannot be cast to clojure.lang.IFn > >> > cgws.notcore/eval2564 (NO_SOURCE_FILE:1) > >> > > >> > doesn't seem truthy to me > >> > > >> > Thanks. > >> > > >> > > >> > On Thu, May 23, 2013 at 3:08 AM, Michał Marczyk > >> > <michal.marc...@gmail.com> > >> > wrote: > >> >> > >> >> On 22 May 2013 18:34, atkaaz <atk...@gmail.com> wrote: > >> >> > I think the exception is thrown because you basically called (every? > >> >> > false > >> >> > coll) however on my clojure version I cannot reproduce it oh wait > >> >> > there > >> >> > we > >> >> > go, some bug here with empty collection (maybe someone can pick it > >> >> > up): > >> >> > => (every? false [1 2 3]) > >> >> > ClassCastException java.lang.Boolean cannot be cast to > >> >> > clojure.lang.IFn > >> >> > clojure.core/every? (core.clj:2423) > >> >> > => (every? false []) > >> >> > true > >> >> > > >> >> > => *clojure-version* > >> >> > {:interim true, :major 1, :minor 6, :incremental 0, :qualifier > >> >> > "master"} > >> >> > >> >> (every? false []) should return true if and only if (false x) is > >> >> truthy for every x in [], which is certainly the case. > >> >> > >> >> Cheers, > >> >> Michał > >> >> > >> >> > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > > >> >> > On Wed, May 22, 2013 at 7:17 PM, Peter Mancini > >> >> > <peter.manc...@gmail.com> > >> >> > wrote: > >> >> >> > >> >> >> So I did some coding and came up with this but it is broken; > >> >> >> > >> >> >> (= java.lang.Boolean (type false)) ;;evaluates to true > >> >> >> > >> >> >> (defn all-true? > >> >> >> [coll] > >> >> >> (every? (cond (= java.lang.Boolean (type identity)) identity :else > >> >> >> false) coll)) ;;compiles > >> >> >> > >> >> >> (all-true? '(true true true)) ;; throws > >> >> >> java.lang.ClassCastException: > >> >> >> java.lang.Boolean cannot be cast to clojure.lang.IFn > >> >> >> (all-true? '(true true false)) > >> >> >> (all-true? '(true true 3)) > >> >> >> > >> >> >> -- > >> >> >> -- > >> >> >> 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/groups/opt_out. > >> >> >> > >> >> >> > >> >> > > >> >> > > >> >> > -- > >> >> > -- > >> >> > 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/groups/opt_out. > >> >> > > >> >> > > >> >> > >> >> -- > >> >> -- > >> >> 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/groups/opt_out. > >> >> > >> >> > >> > > >> > -- > >> > -- > >> > 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/groups/opt_out. > >> > > >> > > >> > >> -- > >> -- > >> 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/groups/opt_out. > >> > >> > > > > -- > > -- > > 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/groups/opt_out. > > > > > > -- > -- > 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/groups/opt_out. > > > -- Softaddicts<lprefonta...@softaddicts.ca> sent by ibisMail from my ipad! -- -- 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/groups/opt_out.