Fork me on GitHub
#off-topic
<
2022-06-24
>
Cora (she/her)17:06:23

sending hugs to anyone struggling today. it's a rough one (here in the US) 💜

❤️ 21
💯 11
🧡 9
💚 9
💛 8
💜 14
💙 3
🤎 3
Cora (she/her)20:06:25

roe v wade was overturned, suddenly making it illegal in many states to have an abortion. the majority opinion included an urging from judge thomas to reassess the right to contraception, gay marriage, and any sex that falls under "sodomy"

3
😬 1
😢 1
Mateusz Mazurczak20:06:40

That's so weird and tragic, I was thinking USA is one of the most progressive countries in those aspects

❤️ 2
Cameron18:06:44

I knew we'd be at risk of flip flopping on abortion one day, even gay marriage, had no idea we were medevil about damned contraception or 'sodomy'. And I'm in the deep south

Cameron18:06:38

Everyone here has always just gotten hot and talked about the first two around me, when speaking of laws at least

winsome21:06:58

Is there a name for the sort order that produces this result: "a0" "a1" "a2" "a3" "a4" "a9" "a10" "a11" As opposed to your basic lexicographic sort: "a0" "a1" "a10" "a11" "a2" "a3" "a4" "a9"

dpsutton22:06:24

that’s the default sorting of tuples

(let [coll ["a0" "a1" "a2" "a3" "a4" "a9" "a10" "a11"]
      to-tuple (fn [s]
                 (let [[_ s' d] (re-matches #"(a)(\d+)" s)]
                   [s' (Long/parseLong d)]))]
  (sort-by to-tuple coll))
("a0" "a1" "a2" "a3" "a4" "a9" "a10" "a11")

dpsutton22:06:33

called pairwise sorting?

hiredman22:06:44

alphanumeric sorting

dpsutton22:06:03

recognize that “a0” is equivalent to the tuple ["a" 0] and just convert into the tuple and sort

hiredman22:06:38

there may be another name, but that is one name for that kind of order

winsome22:06:51

Alright, that can work. Related question - is there a insertion-order-preserving map such that if I call (key m) on it I'll get the keys in insertion order?

dpsutton22:06:22

I think you’ll have to check out java util collections for an insertion ordered map. Clojure does not have one

dpsutton22:06:35

it has notions of ordered maps by both key and val but not by insertion order

hiredman22:06:16

not build into the language, but there are libraries, I don't think I've ever used one

dpsutton22:06:46

i haven’t seen a 3rd party insertion-ordered Clojure map although I’m sure you’re right and it exists somewhere

winsome22:06:46

I'm trying to translate a javascript library that appears to rely on insertion-ordered maps to simplify the implementation. I can get by without (and the fact that it's used seems to be a smell).

dpsutton22:06:23

relying on defined behavior is fine. Insertion-ordered maps are not smelly in my opinion unless you are relying on implementation behavior and not the contract. I think python switched over to insertion-ordered maps by contract (finally, after it just being an implementation byproduct). Possibly javascript does this as well

hiredman22:06:42

I guess we use lacinia which uses that for ordered maps, which I think the graphql spec might require

winsome22:06:51

ooh, and the maps at least are cljc, which is important for me :thumbsup: