nil?

added
1.0

ns
clojure.core

type
function

(nil? x)

Returns true if x is nil, false otherwise.

                user=> (nil? nil)
true
user=> (nil? 0)
false
user=> (nil? false)
false
user=> (nil? '())
false
            
                ;; as nil? is defined as "Returns true if x is nil, false otherwise."
;; and some? is defined as "Returns true if x is not nil, false otherwise."

;; (some? x) is just shorthand for (not (nil? x))
;; this also means that nil? is the same as (not (some? x)) as this
;; just expands into (not (not (nil? x))).

(def nil?? (complement some?))
;;#'user/nil??

(for [x [nil 0 false [] '()]]
   (= (nil? x) (nil?? x)))
;;=> (true true true true true)