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 `+->>+`
11421142 (filter even? (range 1 10)))
11431143----
11441144
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+
11451165=== Threading Macros Alignment
11461166
11471167The arguments to the threading macros `+->+` (thread-first) and `+->>+`
You can’t perform that action at this time.
0 commit comments