This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-17
Channels
- # announcements (3)
- # babashka (41)
- # beginners (118)
- # calva (4)
- # cider (22)
- # clj-kondo (4)
- # clj-on-windows (1)
- # clj-together (1)
- # clojure (164)
- # clojure-europe (46)
- # clojure-filipino (1)
- # clojure-indonesia (1)
- # clojure-my (1)
- # clojure-nl (3)
- # clojure-sg (1)
- # clojure-spec (13)
- # clojure-uk (16)
- # clojurescript (18)
- # cloverage (3)
- # conjure (5)
- # core-async (8)
- # cursive (21)
- # datomic (4)
- # deps-new (15)
- # emacs (12)
- # expound (4)
- # fulcro (45)
- # graalvm (32)
- # jobs (1)
- # malli (5)
- # nextjournal (63)
- # off-topic (27)
- # other-languages (3)
- # pathom (27)
- # proletarian (1)
- # rdf (24)
- # re-frame (10)
- # reagent (9)
- # releases (2)
- # shadow-cljs (72)
- # spacemacs (4)
- # timbre (4)
- # tools-deps (29)
- # xtdb (4)
👋:skin-tone-2:
Good morning 🙂
Morning!
because point free programming is nice? 🙂
(and not pointless)
I can’t really think of a situation where I’d rather use fnil
than or
. What do you guys use it for?
I was at some point playing with the idea of a talk about these fns, comp
, fnil
, some-fn
etc
have you tried this one yet? https://github.com/clj-kondo/clj-kondo/blob/master/doc/linters.md#redundant-fn-wrapper
fnil conj
is also my only repeated example of fnil
usage.
I’d like to use it more, but haven’t seen use cases.
I checked our codebase at work: fnil conj
is pretty common to get the right base type, and fnil into
for the same reason, but far and away the most common for us is (fnil inc 0)
(and a related number of (fnil + 0)
).
I feel like quite a few of these fnil
use-cases could be avoided (although that might not be desirable) by doing something with transduction - i.e. using a reducing function that produces its own initial value on the zero-arity call.
yeah, I like transduce for that. I'm often using this when doing an assoc, or when I'm doing something like frequencies. I should think more about it though.
Hope you all are unharmed by the storm. Here it was only a trash can falling over.
Good morning!
Nobody is playing "Sturmwichteln" over here 😌 . ("Storm Secret Santa" 😉 )
Had to look it up, really like it