Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commenting Clojure within Binding Vector

Tags:

clojure

I've noticed that the comment macro doesn't work from within a binding vector like so:

(let [a "first string"
      (comment 
      b (range 10)
      c [\a \b \c]
      )
      d "another string"]
  (str a " and " d))

Besides placing a semicolon in front of each line in the comment block, are there any other ways to comment several bindings within a binding vector that expects an even number of arguments?

like image 299
Giles Avatar asked Jan 12 '12 15:01

Giles


1 Answers

You can use the #_ reader macro, which will make the reader completely ignore the next form:

(let [a "first string"
      #_( 
      b (range 10)
      c [\a \b \c]
      )
      d "another string"]
  (str a " and " d))
like image 138
mtyaka Avatar answered Sep 27 '22 21:09

mtyaka