목차

Threading Macro

Don'ts

Navigation, Transformation, and Sequence: That's it for the “do's.” The rest are all “don'ts.”

Don't mix -> and ->>

Don't thread arithmetic

Don't use anonymous functions to change argument position

;; BAD
(-> results
    :matches
    (#(filter wining-match? %)) ; BAD
    (nth 3)
    :scores
    (get "total_points"))
 
;; BETTER
(let [wins (filter winning-match? (:matches results))]
  (-> wins
      (nth 3)
      :scores
      (get "total_points")))

Don't mix threading macros with other syntactic macros

Docs


관련 문서