File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -814,16 +814,15 @@ Note that the exclamation mark is often pronounced as bang.
814
814
815
815
* https://github.com/bbatsov/clojure-style-guide#naming[Clojure Style Guide]
816
816
817
- == `_` - Irrelevant var
817
+ == `_` - Unused argument
818
818
819
- When you see the underscore character used as function arguments or similar,
820
- it is a common _naming convention_ for vars or arguments you are not interested in using.
821
- That is you don't intend to use them, so you aren't really interested in
822
- thinking of a useful name for them.
819
+ When you see the underscore character used as function arguments or in a `let` binding,
820
+ `_` is a common _naming convention_ to indicate you won't be using this argument.
823
821
824
822
This is an example using the `add-watch` function that can be used to add
825
823
callback style behaviour when atoms change value. Imagine, given an atom, we
826
- want to print the new value every time it changes
824
+ want to print the new value every time it changes:
825
+
827
826
[source,clojure]
828
827
----
829
828
(def value (atom 0))
@@ -836,8 +835,9 @@ want to print the new value every time it changes
836
835
(reset! value 9)
837
836
; prints 9
838
837
----
838
+
839
839
`add-watch` takes four arguments, but in our case we only really care about the
840
- last argument - the new value of the atom.
840
+ last argument - the new value of the atom so we use `_` for the others .
841
841
842
842
== `,` - Whitespace character
843
843
You can’t perform that action at this time.
0 commit comments