practicalli / practicalli/clojure
Comment reader macro - more than just a line comment
Nobody has claimed this yet.
- Dominant language
- Makefile
- Stars
- 117
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
#_ is the comment reader macro and is used to comment a Clojure form (Clojure code that can be evaluated). #_ is not just a line comment.
You can place #_ before the start of a form and everything inside that form will be commented
#_(def my-data [1 2 3 4 5])
#_ will comment forms that span multiple lines, for example function definitions
#_(defn my-function
[args]
(str "I am an experiment, so not always needed"))
#_ can also be put on the line before the comment (possibly many lines - to test). This approach can make your code more readable and keep alignment of your code consistent.
comment nested forms
#_ tells the reader to ignore the next form, it is therefore never evaluated and neither is the #_. This means that #_ can be used inside a nested form to comment just a part of the expression
In this example the third vector of values is not read by the Clojure reader and therefore is not passed as an argument to + function by map
(map + [1 2 3] [4 5 6] #_[7 8 9])
Stacking comments
The comment reader macro has the ability to stack these comments on forms
#_#_ to comment out two successive forms
For example in a let form we can comment out a name binding that is causing problems. As the name and value are both forms, then we use a stacked #_ to comment both out.
We also do the same in the body of the let, so as to not include the evaluation of the string or name2 local name in the str form.
(let [name1 "value"
#_#_name2 "another-value]
(str "First name is: " name1 #_#_" second name is: " name2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No target file or test is named in the issue. Start by locating the repository documentation for Clojure reader macros and compare its treatment of #_ with the examples here. Done means the documentation explains multiline, nested, and stacked comment forms accurately, with corrected examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- clojure
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100