special symbol | since v0.0-1853 | in clojure | in edn | Edit |
nil
is a representation of nothing. Its underlying representation is
JavaScript's null
, and is equal to JavaScript's undefined
when compared.
It is common for operations to safely handle nil
without
causing exceptions.
Expressions evaluate to nil
if there is no value to return.
nil
;;=> nil
nil
can sometimes mean "not found":
(:foo {})
;;=> nil
nil
can also mean that the operation didn't make sense:
(:foo nil)
;;=> nil
(defn- read-symbol
[rdr initch]
(let [[line column] (starting-line-col-info rdr)]
(when-let [token (read-token rdr :symbol initch)]
(case token
;; special symbols
"nil" nil
"true" true
"false" false
"/" '/
(or (when-let [p (parse-symbol token)]
(with-meta (symbol (p 0) (p 1))
(when line
(merge
(when-let [file (get-file-name rdr)]
{:file file})
(let [[end-line end-column] (ending-line-col-info rdr)]
{:line line
:column column
:end-line end-line
:end-column end-column})))))
(err/throw-invalid rdr :symbol token))))))