1. 7

  2. 3

    As the comment form is a macro, its contents have to be syntactically valid or else you’ll get an error from the compiler. OTOH it also allows you to do some truly bizarre stuff like:

    (->> some-values
     (map (partial + 3))
     (filter pos?)
     ; by the way ...
     (let [some-values [-7 0 -2 1 -3]])
     (comment actually, never mind!))
    1. 6

      Another quirk of the comment macro is that it actually has a value of nil! That means it can change the behavior of your program if it appears inside a conditional form like if or a functional map like:

      (map <= [-1 2 3] [3 2 1] (comment away we go!))

      IMO there are too many surprises to recommend using it and I wish the author of this article had brought them to light.

      1. 1

        True, but wouldn’t you write

        (map <= [-1 2 3] (do (comment away we go!) [3 2 1]))


        Non-idiomatic probably, but I’ve learned my lessons regarding sprinkling (println) the hard way ;)