Evaluates exprs one at a time, from left to right. If a form
returns logical false (nil or false), and returns that value and
doesn't evaluate any of the other expressions, otherwise it returns
the value of the last expr. (and) returns true.
user=> (and true true) true user=> (and true false) false user=> (and false false) false user=> (and '() '()) () user=> (and '[] '[]) [] user=> (and 0 1) ; Note that this is *not* bitwise 'and' 1 user=> (and 1 0) 0 user=> (and (constantly true) (> 2 1)) true
(defmacro and
"Evaluates exprs one at a time, from left to right. If a form
returns logical false (nil or false), and returns that value and
doesn't evaluate any of the other expressions, otherwise it returns
the value of the last expr. (and) returns true."
{:added "1.0"}
([] true)
([x] x)
([x & next]
`(let [and# ~x]
(if and# (and ~@next) and#))))
Comments top
No comments for and. Log in to add a comment.