Fork me on GitHub
#clojure-europe
<
2021-01-29
>
ordnungswidrig09:01:24

All snow is gone. Does anybody have an idea what this green stuff is? :thinking_face:😂

otfrom09:01:27

Astroturf if you are in the Houston Astros stadium, but asterturf everywhere else

RAMart09:01:21

Your snow is just moldy.

🎯 1
pez10:01:24

What green stuff?

slipset10:01:19

minus 15 outside Oslo this morning.

metal 2
slipset11:01:14

what’s the :>> thingy?

otfrom11:01:41

test-expr :>> result-fn
 Note :>> is an ordinary keyword

otfrom11:01:56

puts the result of the predicate into the function on the RHS

borkdude11:01:41

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)

borkdude11:01:11

but you can also pull it out into a let I guess

otfrom11:01:00

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

slipset11:01:11

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.

slipset11:01:06

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.

dharrigan11:01:08

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?

borkdude11:01:34

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

slipset11:01:19

I guess it boils down to “clever” code.

dharrigan11:01:39

that would remove dependencies and encourage small, reasoned growth of the core library.

borkdude11:01:15

(require '[clojure.core.match :refer [match]])

(defn regex [x]
  (re-matches #"(\w+)->(\w+)" x))

(match "foo->bar"
       ([_ x y] :<< regex) [x y]
       :else [])

borkdude11:01:30

;;=> ["foo" "bar"]

otfrom13:01:31

got some good help on a transducer question on #beginners https://clojurians.slack.com/archives/C053AK3F9/p1611850109057600

😺 1
otfrom13:01:41

I didn't know that identity is a transducer on its own

💡 4