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.
user> (or true false false) true user> (or true true true) true user> (or false false false) false user> (or nil nil) nil user> (or false nil) nil user> (or true nil) true ;; or doesn't evaluate if the first value is true user> (or true (println "foo")) true ;; order matters user> (or (println "foo") true) foo true
(defmacro or
"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."
{:added "1.0"}
([] nil)
([x] x)
([x & next]
`(let [or# ~x]
(if or# or# (or ~@next)))))
Comments top
No comments for or. Log in to add a comment.