This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-11
Channels
- # announcements (6)
- # babashka (61)
- # beginners (85)
- # calva (21)
- # cider (6)
- # clara (9)
- # clj-http (1)
- # clj-kondo (35)
- # cljfx (6)
- # clojure (91)
- # clojure-australia (11)
- # clojure-europe (23)
- # clojure-italy (7)
- # clojure-losangeles (2)
- # clojure-nl (27)
- # clojure-uk (107)
- # clojurescript (4)
- # community-development (1)
- # cursive (69)
- # emacs (12)
- # fulcro (29)
- # graalvm (25)
- # honeysql (10)
- # hugsql (3)
- # integrant (13)
- # jobs (4)
- # kaocha (3)
- # keechma (1)
- # lambdaisland (3)
- # leiningen (2)
- # meander (17)
- # mount (3)
- # observability (1)
- # off-topic (86)
- # pathom (3)
- # polylith (2)
- # practicalli (14)
- # reitit (14)
- # shadow-cljs (61)
- # startup-in-a-month (1)
- # tools-deps (9)
- # vim (54)
- # xtdb (16)
@hobosarefriends Whatcha doing in Zwolle?
style question: how do you feel about mixing threading macros? e.g.
(-> lots-of-maps
(->> (filter beautiful-things)
(sort-by :very-important-key))
first
:actual-important-key
(or meaningful-default))
I would try to avoid them, cause it operates on different contexts in “one place”, ->
assumed to be used with assoc data and ->>
with collections
I guess you can optimize your data shape for a given need, but in my case the same data is pulled from all sorts of direction so either I create N optimal views or I pull things from an almost always suboptimal shape
In the previous example I would do filtering and sorting before passing it to the threading macro. But that's because of my aforementioned fear.
What if you give it a name (in a let block)?
lots-of-maps
(->> (filter beautiful-things)
(sort-by :very-important-key))
or maybe use this https://clojuredocs.org/clojure.core/as-%3E
also I feel like having or
in threading macro is a bit confusing to read, maybe (get foo key default)
is easier
Now that we're on the topic of threading macros: https://gist.github.com/borkdude/93efc3f5978a2ed545553a47caaf7aa8