macro | since v0.0-927 | clojure.core/or | Edit |
(or)
(or x)
(or x & next)
Evaluates arguments one at a time from left to right. If an argument returns
logical true, or
returns that value and doesn't evaluate any of the other
arguments, otherwise it returns the value of the last argument.
(or)
returns nil.
(or)
;;=> nil
(or false)
;;=> false
(or true)
;;=> true
(or true true)
;;=> true
(or true false)
;;=> true
(or false false)
;;=> false
nil
and false
are the only falsy values and everything else is truthy:
(or "foo" "bar")
;;=> "bar"
(or "foo" nil)
;;=> "foo"
(or "foo" false)
;;=> "foo"
(or nil "foo")
;;=> "foo"
(or false "foo")
;;=> "foo"
Evaluates exprs one at a time, from left to right. If a form returns a logical true value, or returns that value and doesn't evaluate any of the other expressions, otherwise it returns the value of the last expression. (or) returns nil.
(core/defmacro or
([] nil)
([x] x)
([x & next]
`(let [or# ~x]
(if or# or# (or ~@next)))))