#_ ignore

syntaxsince v0.0-1853 in clojure in ednEdit

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))

Details:

Causes the following form to be completely skipped by the reader. This is a more complete removal than the comment macro which yields nil.


Examples:

{: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]

See Also:


Reader code @ tools.reader:src/main/clojure/clojure/tools/reader.clj
(defn- read-discard
  [rdr _ opts pending-forms]
  (doto rdr
    (read* true nil opts pending-forms)))

Reader table @ tools.reader:src/main/clojure/clojure/tools/reader.clj
(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))