Fork me on GitHub
#clojure-uk
<
2017-03-30
>
thomas07:03:54

so... how does Art 50 feel?

korny07:03:31

Don't forget to set your clocks back 44 years, folks

thomas07:03:43

Is there somewhere a clock that counts down?

thomas07:03:07

or do I feel a little CLJS project coming on....

otfrom08:03:19

thomas the clocks started running backwards

thomas08:03:23

@otfrom for two years.... or for 44 years?

thomas08:03:42

or do they just explode at some point?

tcoupland08:03:06

man go to one meeting and i missed zipmap day! It's one of my fav's!

dominicm09:03:12

What shall we cover today. When-first?

thomas09:03:38

never seen that one before.... interesting.

Sam H09:03:13

Was just doing a quick search for when-first on github, I assume this usage is not doing what he thinks it should be:

(when-first [resource [(io/resource "config/config.private.edn")
                       (io/resource "config/config.default.edn")]]
  (defconfig config resource))

thomas10:03:51

I suspect not... has anyone tried it?

thomas10:03:13

maybe or would do the trick here

tcoupland10:03:07

like when-first! new to me to

tcoupland10:03:01

hmm, trouble with or there is it wants a seq, remove nil? wld do, but it would look ugly

reborg10:03:36

@shan Yeah, that's essentially:

(let [xs (seq resources)]
  (when xs
    (let [resource (first xs)]
      (defconfig config resource))))
Which never looks after the first element. The goal was probably the single liner: (defconfig config (some identity resources))

thomas10:03:22

when-let for the first line maybe?

korny10:03:54

I don't really see what the use of when-first is - when would it be actually useful? Rather than just obfuscation?

korny10:03:43

My favourite slightly obscure clojure macro is as->

mccraigmccraig10:03:08

i also like as->

dominicm10:03:42

@korny because (when-let [x (first xs)] …) isn't correct.

acron10:03:34

@dominicm why isn't it correct?

dominicm10:03:33

Well, it isn't correct if you want to say "get the first thing off this sequence if it exists"

dominicm10:03:39

@acron The when won't work for sequences like (false) or (nil)

acron10:03:24

true, true

reborg10:03:18

"when-first" name is not as intuitive to me...

reborg10:03:56

I think it's there to essentially avoid the noisy repetition in (when (first xs) (let [head (first xs)] head))

dominicm10:03:16

@reborg I agree, not a great name. But I think the shortcut is good.

korny11:03:31

it also avoids evaluating (first xs) twice, I think.

mccraigmccraig11:03:01

i still hate the giant clojure.core namespace @thomas ... stockholm syndrome has never set in

korny11:03:12

it translates to (let [temp (first xs)] (when temp (let [head temp] ... do stuff with head ...))

korny11:03:10

I definitely think there'd be value in an occasional prune of these functions - when-first is no juxt 🙂

Rachel Westmacott12:03:55

yes, usage of juxt is rare, but when you need it it's just the ticket!

Rachel Westmacott12:03:55

I think the only time the size of clojure.core annoys me is when I'm trying to name something and discover that all the short names have been taken.

mccraigmccraig13:03:02

i find two things about clojure.core - it makes learning clojure harder, because it's hard to browse related fns and it buries many functions like when-first or (i discovered a few days ago) keep

Rachel Westmacott13:03:23

yeah - discoverability is an issue for sure

Rachel Westmacott13:03:51

but on the flip side, having so many core functions that operate over the sequence abstraction is part of what makes the language awesome

Rachel Westmacott13:03:11

although personally I'd happily live without when-first

thomas13:03:19

keep is new to me as well.. looks nice to get a subset of vals though from a map

thomas13:03:26

but select-keys is also very handy in that context

Rachel Westmacott13:03:37

I think maybe a "core-function-of-the-day" plugin could be useful, based on the functions you haven't used in your codebase

thomas13:03:44

@peterwestmacott or that looks at your github pages and decides based on that

korny15:03:13

Once you know a number of them, they become vital. I'm close to building a rosetta stone of "how do I do these things in Java8" so I can solve a problem in clojure in my head, and then translate it into some horrible stream-based mess...

yogidevbear19:03:20

Anyone watch Tim Baldridge's talk at Clojure/West on Core.Async in Use yet? He is really succinct in his presentation

gjnoonan19:03:59

Just watching it now actually

yogidevbear19:03:36

Feels like the takeaway is very much paralleled with what @agile_geek has been talking about with focus more around design decisions than the finer details of the written code

gjnoonan19:03:43

Big fan of @tbaldridge, His Youtube channel is worth a subscribe

yogidevbear19:03:39

Just subscribed 😄

gjnoonan20:03:33

Sit down and binge watch them all lol

yogidevbear20:03:42

I'm very tempted (even though I'm nearly falling asleep on my feet at the moment)

gjnoonan20:03:16

Tim's voice is a nice one to fall asleep to, been there, done that haha

korny20:03:05

Does it send babies to sleep?

dominicm20:03:50

I've heard that talking about the details of work will do that.

yogidevbear20:03:26

Interpreted by baby as "blah blah blah bla... ... ... ... 😴"

yogidevbear20:03:44

@korny How old is your little one now?

korny20:03:43

3.5 months. And asleep now, so time for me to copy him!

gjnoonan21:03:32

Ah I remember them days well!