Fork me on GitHub
#beginners
<
2021-09-16
>
Benjamin12:09:01

is it just style or is there 1 way that is more idiomatic in clojure?

(-> (curr-proj-sln) collect-comps-and-post)
(collect-comps-and-post (curr-proj-sln))

;; it would be in the context of a project that uses -> a lot

pavlosmelissinos12:09:06

Not sure if either is more idiomatic than the other. Both look fine to me.

daveliepmann12:09:21

I prefer to avoid threading in cases like this, but I don't think that opinion is broadly shared.

manutter5112:09:39

If you’re only nesting one fn inside another, it’s likely six of one half a dozen of the other as to which style you use. I tend to use arrows for three or more operations in a row, just for easier readability.

👍 2
Johan Thorén12:09:54

I also tend to use threading macros for 3 or more operations. In the examples above I don't see any readability improvement from using it, it rather makes it more complex.

Benjamin13:09:46

only using -> for 3+ sounds reasonable