Fork me on GitHub
#clojure-uk
<
2017-07-07
>
yogidevbear07:07:27

☀️ Morning

thomas07:07:19

morning 😼 mogge

mccraigmccraig08:07:21

🙃 umown 🙂

chrjs08:07:58

maleghast10:07:07

I almost never have two back to back any more… It’s that kind of a Friday…

maleghast10:07:18

Still “HELLO!” to you all 🙂

Rachel Westmacott11:07:58

does anyone have a clever trick for using or within ->>?

reborg11:07:49

'some->>' ?

glenjamin11:07:41

got a concrete example? i think in practice i’ve usually come up with a named function to represent that step

mccraigmccraig12:07:04

i sometimes stick a (#(or % :foo)) step in. feels a bit dirty tho

Rachel Westmacott12:07:18

In the end I have changed my ->> for a -> and turned my (re-find #"re") step into a (->> (re-find #"re"))

Rachel Westmacott12:07:25

I did consider a custom or-like macro that reversed its arguments first, but it didn’t seem worth it.

Rachel Westmacott12:07:22

yes, but with as-> I cannot use bare keywords or functions

Rachel Westmacott12:07:38

eg. (as-> {:foo 1} x :foo inc)

madstap13:07:35

I think the friction is because the re-* functions have their arguments backwards

Rachel Westmacott14:07:49

it would also be nice if regexes acted as functions

Rachel Westmacott15:07:06

or maybe if re-find handled nils gracefully

Sam H15:07:09

what’s the clojure way of comparing lists/seqs when you don’t care about the order of the items?

dominicm15:07:39

oh, I guess duplication might matter.

Sam H15:07:59

yeah, I’m currently just converting both my actual and expected lists into sets

Sam H15:07:12

otherwise I guess I could order if I care about dups

Sam H15:07:07

Thought there might be a nicer way to do the comparison. Don’t really want to pull in midje just for this https://github.com/marick/Midje/wiki/Checkers-for-collections-and-strings

glenjamin15:07:53

sort them both?

glenjamin15:07:19

(defn same-contents [a b] (= (sort a) (sort b))) should work?

tcoupland15:07:37

sets! they are always the answer 🙂

tcoupland15:07:29

should read more, before commenting... 🐢

madstap17:07:07

You could also use frequencies if you care about duplicates