File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1142,6 +1142,26 @@ Prefer the use of the threading macros `+->+` (thread-first) and `+->>+`
1142
1142
(filter even? (range 1 10)))
1143
1143
----
1144
1144
1145
+ === Threading Macros and Optional Parentheses
1146
+
1147
+ Parentheses are not required when using the threading macros for functions having no argument specified, so use them only when necessary.
1148
+
1149
+ [source,clojure]
1150
+ ----
1151
+ ;; good
1152
+ (-> x fizz :foo first frob)
1153
+
1154
+ ;; bad; parens add clutter and are not needed
1155
+ (-> x (fizz) (:foo) (first) (frob))
1156
+
1157
+ ;; good, parens are necessary with an arg
1158
+ (-> x
1159
+ (fizz a b)
1160
+ :foo
1161
+ first
1162
+ (frob x y))
1163
+ ----
1164
+
1145
1165
=== Threading Macros Alignment
1146
1166
1147
1167
The arguments to the threading macros `+->+` (thread-first) and `+->>+`
You can’t perform that action at this time.
0 commit comments