syntax | since v0.0-1853 | in clojure | in edn | Edit |
Ignore the next well-formed expression.
[1 #_foo 2 3]
=> [1 2 3]
Also useful for commenting out a multi-line expression:
#_(defn foo [a b]
(+ a b))
Causes the following form to be completely skipped by the reader. This is a
more complete removal than the comment
macro which yields nil.
{:foo #_bar 2}
;;=> {:foo 2}
To comment out the last line of a function without worrying about commenting out the trailing parentheses:
(defn foo []
(println "hello")
#_(println "world"))
Whitespace is optional:
[1 2 #_ foo 3]
;;=> [1 2 3]
(defn- read-discard
[rdr _ opts pending-forms]
(doto rdr
(read* true nil opts pending-forms)))
(defn- dispatch-macros [ch]
(case ch
\^ read-meta ;deprecated
\' (wrapping-reader 'var)
\( read-fn
\= read-eval
\{ read-set
\< (throwing-reader "Unreadable form")
\" read-regex
\! read-comment
\_ read-discard
\? read-cond
\: read-namespaced-map
\# read-symbolic-value
nil))