Fork me on GitHub
#clojure-uk
<
2019-08-27
>
thomas07:08:45

mogge 😼

alexlynham07:08:07

Man the Clojure subreddit really is just relentless stanning half the time

alexlynham07:08:59

You can tell something is over keen when you broadly agree with the sentiments expressed and still want to nope out

mccraigmccraig07:08:46

til: stanning, verb, be an overzealous or obsessive fan of a particular celebrity

thomas07:08:13

Rich Hickey?

dominicm08:08:58

I'm not obsessed with Rich, I'm just his biggest fan.

dominicm08:08:14

In other news, I'm attempting to grow an afro

dominicm08:08:28

Rich's hair is really quite complex :thinking_face:

😂 4
thomas08:08:45

Rich removed all the complexity from the code and put it in his hair. Same goes for David Nolen and Ambrose Bonnaire-Sergeant.

dharrigan09:08:10

Would you say his hair is Complect?

rickmoynihan09:08:48

I don’t think Rich braids his hair — complect-hair would be dreadlocks right?

thomas09:08:26

@dharrigan Rich's hair is certainly more complect then my hair.

thomas09:08:36

Mine just a bit of plastic 😉

thomas09:08:58

not today @jasonbell... 😉

rickmoynihan09:08:05

> You can tell something is over keen when you broadly agree with the sentiments expressed and still want to nope out A colleague of mine I think accurately (if harshly summed this up as): Clojure come for the functional lisp, stay for the stockholm syndrome :rolling_on_the_floor_laughing:. He’s a massive clojure advocate, but was I think a bit worn out by the types vs dynamic types debate; somewhat stoked by the Maybe not talk.

alexlynham09:08:38

does that colleague’s name begin with ‘s’ and end with something that rhymes with “wat ho!”

rickmoynihan11:08:32

:rolling_on_the_floor_laughing: no not him… it’s one I don’t think you’ve met.

alexlynham07:08:42

Haha it sounds like something he'd say

rickmoynihan09:08:07

At the end of the day though Clojure as a language takes a philosophical stance on software development, with a strong sense of what is idiomatic clojure code. That’s totally great, but it doesn’t need to be religion. The clojure philosophies tend to work well within the language and support each other, but that doesn’t mean they’re the only way; or that other languages/approaches objectively wrong. I also don’t think anyone in particular is actually saying that; it’s just that the debates can sometimes give that impression.

dominicm09:08:30

Haskell is objectively wrong. It's distinctly missing objects.

rickmoynihan09:08:17

Oh I don’t know… Lambda is the ultimate imperative, the ultimate declarative, and I recon the ultimate object 🙂

alexlynham09:08:42

potentially dumb question, my intuition has always been that

(map (comp fn2 fn1) coll)
would be quicker than
(->> coll
     (map fn1)
     (map fn2))
…a slightly contrived example, but you get the gist. Basically when you have multiple sequential map operations, if the fns (`fn1` and fn2 in this example) are composable I’d generally have assumed that the program will run quicker if you roll them into one step. But is that actually the case?

rickmoynihan09:08:47

yes that would usually be true as you’re not creating intermediate sequences in the former case, so you’ll likely get less GC. But you’ll need to measure to be sure it’s true for your case. However if you really want performance, and don’t require laziness you may find transducing is faster still… i.e. something like: (sequence (comp (map fn1) (map fn2)) coll) But again you’ll need to measure on realistic data

Ben Hammond10:08:59

you need pretty big inputs to notice any difference?

Ben Hammond10:08:16

and then ease-of-maintenance becomes more important

rickmoynihan11:08:30

agreed on both counts… lazy sequences are pretty quick, so I’d normally default to them as they’re the most idiomatic & flexible option as not all sequence ops have transducible implementations in clojure.core… so I find I usually need to pull in cgrands xforms if I’m doing anything much more complicated than basic map/filter/reduce things (also having x/for is super handy.)

maleghast09:08:56

Morning All 👋

alexlynham09:08:27

@rickmoynihan yeah, I was about to raise transducers haha

alexlynham09:08:43

okay, so TL;DR - benchmark it, but probably a qualified ‘yes’