This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-16
Channels
- # announcements (19)
- # babashka (13)
- # beginners (7)
- # calva (8)
- # cider (25)
- # clj-kondo (12)
- # cljsrn (7)
- # clojure (60)
- # clojure-australia (5)
- # clojure-europe (59)
- # clojure-france (14)
- # clojure-gamedev (2)
- # clojure-nl (1)
- # clojure-uk (7)
- # clojurescript (43)
- # community-development (8)
- # core-async (2)
- # cursive (15)
- # datomic (75)
- # deps-new (31)
- # depstar (1)
- # fulcro (6)
- # graalvm (53)
- # holy-lambda (1)
- # juxt (3)
- # jvm (13)
- # kaocha (8)
- # lsp (109)
- # malli (14)
- # off-topic (62)
- # pathom (11)
- # pedestal (12)
- # polylith (12)
- # releases (5)
- # sci (5)
- # shadow-cljs (15)
- # sql (16)
- # tools-deps (27)
- # vim (1)
- # xtdb (14)
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
Not sure if either is more idiomatic than the other. Both look fine to me.
I prefer to avoid threading in cases like this, but I don't think that opinion is broadly shared.
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.
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.
@U02CV2P4J6S, also be aware of these recommendations: https://guide.clojure.style/#threading-macros https://guide.clojure.style/#threading-macros-and-optional-parentheses https://guide.clojure.style/#threading-macros-alignment I find the style guide to be a source of many good examples.