Buongiorno!
Morning
👋
Good morning!
moin moin
G’moie!
Morning
Morning
Morning!
morning
All snow is gone. Does anybody have an idea what this green stuff is? :thinking_face:😂
Astroturf if you are in the Houston Astros stadium, but asterturf everywhere else
Your snow is just moldy.
What green stuff?
minus 15 outside Oslo this morning.
TIL: https://clojuredocs.org/clojure.core/condp#example-59ce4beae4b03026fe14ea4d
:>>
what’s the :>>
thingy?
test-expr :>> result-fn
Note :>> is an ordinary keyword
puts the result of the predicate into the function on the RHS
TIL
I wish cond->
has this since I sometimes need the condition in the result (which gives rise to things like better-cond or else-thread https://gist.github.com/borkdude/93efc3f5978a2ed545553a47caaf7aa8)
but you can also pull it out into a let I guess
what is cool about things like better-cond etc is that it can be done easily, what is bad is that you can end up with conflicting small dependencies if you don't copypasta code like that
It raises a, to me, interesting question, which is how much of a dsl you should add into a “feature”. Like, the common-lisp format and loop constructs are almost languages in them selves.
I guess it depends on how often you use a thing. The dsl that is destructuring is ok, because I use it all the time, the :>>
thingy is something I’d likely not use, and if I did, it would confuse my cowworkers.
Perhaps there should be a poll across the community to discover small 3rd party extensions like better-cond, vote on them and promote them into the core library?
I guess it boils down to “clever” code.
that would remove dependencies and encourage small, reasoned growth of the core library.
(require '[clojure.core.match :refer [match]])
(defn regex [x]
(re-matches #"(\w+)->(\w+)" x))
(match "foo->bar"
([_ x y] :<< regex) [x y]
:else [])
;;=> ["foo" "bar"]
See this gist: https://gist.github.com/borkdude/93efc3f5978a2ed545553a47caaf7aa8 I think this covers most of these weird macro combinations, and the macro is super simple
Morning
got some good help on a transducer question on #beginners https://clojurians.slack.com/archives/C053AK3F9/p1611850109057600
I didn't know that identity is a transducer on its own