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.


Reply via email to