Fork me on GitHub
#clojure-europe
<
2020-08-18
>
plexus07:08:19

seq on a coll is idiomatic, but not everyone is familiar with the idiom :)

ordnungswidrig07:08:48

not-empty? should be a thing. 🙊

plexus07:08:53

Whereas remove empty is just English

plexus07:08:15

Morning :)

plexus07:08:38

(def not-empty? seq)

otfrom08:08:20

@plexus yeah, but idioms exist in communities and communities are created

otfrom08:08:28

I'm wondering if I'm insisting on the right norms or not

plexus08:08:32

idioms are only idioms to the extent that they are commonly used and understood, I guess either you lean into it and use it freely so people also have more chance of coming across and absorbing the idiom, or you go the other way. It also really depends on your audience. If I use (some #{foo} coll) in a lambda island episode then I feel like I need to explain that, so I may use (contains? (set coll) foo) which I think is a bit more readily understood. But in my own code I would probably write (some #{foo} coll)

otfrom08:08:16

agree completely on use and leaning into the use being the important thing about idioms

otfrom08:08:43

that contains? bit confuses me, but then I don't use contains? much as it feels like a false friend when I think about using it

otfrom08:08:37

I suppose it is useful for being able to do things like this:

user> (contains? {:a nil} :a)
true
user> (contains? {} :a)
false

borkdude09:08:10

I use contains? etc on hot paths since it's more performant:

user=> (time (let [m {:a 1} k :a] (dotimes [i 100000000] (some m [:a :b]))))
"Elapsed time: 2553.732969 msecs"
nil
user=> (time (let [m {:a 1} k :a] (dotimes [i 100000000] (or (contains? m :a) (contains? m :b)))))
"Elapsed time: 553.231016 msecs"
nil

otfrom09:08:14

👋 @florin.braghis

plexus10:08:04

#cestmeetup is today! First talk is "premiering" on youtube. You can watch it from the start once it finishes (in 15 minutes or so), or watch it on the stream tonight at 7pm CEST

plexus10:08:31

(17:00 UTC)