Skip to content

clojure.core/and

View this page on ClojureDocs

Type: macro Added: Clojure 1.0 Examples: 4 Runnable: 3
([] [x] [x & next])

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.

Examples

by dakrone on
by jafingerhut on
by Lacty on . May have evaluation errors.
by Rovanion on

Note by huahaiy

Note add is a macro, so you cannot apply it. For example, there is a vector of some Boolean values [true true false true], which you want to test to see if they are all true. The code below will not work:

(apply add [true true false true]) ;won't work
Instead, use this:
(every? identity [true  true false true])
More discussion can be found at http://osdir.com/ml/clojure/2010-01/msg01242.html

Note by dilipd

typo: 'and' instead of 'add'?

See also


Content from the matching ClojureDocs page, with authors credited on each contribution.