I'm in the following situation: (and '(true true)) ;doesn't work
I tried apply, reduce, and a few other things. Reading the apidocs, reduce is said to be the proper choice to compute a boolean from a seq. But: (reduce and '(true true)) ;Exception: Can't take value of a macro: #'clojure.core/and Also, the following isn't the solution: (reduce 'and '(true false true)) ;true In any case, I think using reduce with "and" wouldn't be nice because it won't return false as soon as it can like "and" does. Therefore, I came up with the following working solution: (defmacro and-booleans [logical-booleans-list] `(and ~...@logical-booleans-list)) (and-booleans (true false true)) ;false But I wonder if I have overlooked something fundamental, either about reduce or anything else. Of course, I could have built my final boolean value imperatively, in effect reimplementing "and" for lists as a function that wraps the "ant" built-in macro. But I'm hoping to leave imperative programming as much behing me as possible. What would you consider the normal way of solving this small problem of mine? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---