Fork me on GitHub
#clojure-uk
<
2019-06-19
>
benedek06:06:23

morning

πŸ‘‹ 4
rlj06:06:10

Are the slides from last night's Crux gathering available?

πŸ‘‹ 4
3Jane06:06:18

there's a link to slides in the post

3Jane06:06:55

whoops, I'll let the authors take over ^^'

yogidevbear06:06:49

Lol, thanks @U82DUDVMH, I forgot about that post

refset12:06:14

Those are older slides, but we will get around to uploading what was presented soon. Hopefully the video will be ready for next week and we will push out a blog with all the links πŸ™‚

Olical08:06:31

Morning! Was a great meetup πŸ˜„

πŸ‘ 12
parens 4
πŸ‘Œ 4
practicalli-johnny08:06:20

Thanks to the JUXT team for a fascinating evening of bitemporal discovery. And thanks to all at Funding Circle for organising the event.

πŸ‘ 4
πŸ™ 4
practicalli-johnny08:06:23

There is a virtual Clojure data science meetup this Wednesday afternoon. I have enjoyed these very much so far. https://zoom.us/meeting/register/e50c2d960a1ecd1d7510d14dfea9e911

djtango09:06:49

Fun Q: single quotes in identifiers - great idea or horrible abuse of syntax?

(fn f [x]
  (fn f' [y]
    ,,,))
(defn fermat's-last-theorem [a b c n]
  (let [** #(Math/pow %1 %2)]
    (= (+ (** a n) (** b n)
       (+ (** c n)))))

practicalli-johnny11:06:21

This is all kinds of awful, sorry... To me it shouts out a developer does not understand the purpose of the code they are writing (or are having a bad day and need a hug)

simonkatz11:06:14

I sometimes use a single quote at the end of a name. clojure.core does too eg +' I've never used a single quote as an apostrophe, nor have I seen it.

djtango14:06:29

@U05254DQM just saw your reply - quite a strong stance. Do you use much currying in your code? I find naming curried functions often to be a bit fiddly/pointless but it is useful to name anonymous functions if only because you get the name in the stack trace if it fails

practicalli-johnny21:06:57

I think I was referring to the naming of symbols (which is a hard problem I agree) and yes I also agree its useful to name in-line function definitions for debugging, although I tend to refactor in-line functions to defn as soon as they get any sign of complexity.

mccraigmccraig09:06:48

i've seen that used after the math fashion @djtango , to refer to a derived value. horrid in your second example tho

πŸ‘ 4
jasonbell09:06:07

@djtango Well I can’t speak for anyone else but I’m shuddering at the thought.

djtango09:06:50

ha - something that is a bit irksome about clojure's stack traces is that if you use function literals, you see a fn-gensym which makes them all the more impenetrable

djtango09:06:25

so fine, name your fns in your specs and when using them as higher order functions but if you have a legitimate need to curry something you're left having to think of a name...

Ben Hammond09:06:48

I find them hard to read

Ben Hammond09:06:44

much less mentally taxing to use f2 f3 rather than f' f''

djtango09:06:42

I guess f2 f3 is less arcane and leaves the reader less prone to trying to guess what the significance of ' means if they're unfamiliar with the convention

guy09:06:12

I think its exactly as u say @djtango if you are used to it, its fine. But typically i havent seen it much in clojure.

Ben Hammond09:06:36

heh. Under what circumstances is it okay to use non-alphanumerics in a symbol

djtango09:06:40

(let [x' (Ξ” x y)]
  ,,,)
troll

Ben Hammond09:06:15

if its a map, I might name it

(def this->that {:this  :that}

djtango09:06:33

x->y is pretty common in Clojure - as you say

djtango09:06:01

I've seen +a-constant+ in some places

djtango09:06:33

and I've used things like rrp+tax as names before

dharrigan09:06:31

Personally, I'm doing string->map and other such things

practicalli-johnny11:06:26

so long as that is all that the function does. If it has business logic in the function, then it should be named to represent that logic. If the business logic is in a calling function, then this is correct as of the style guide.

dharrigan12:06:37

yeah, basically, it's this:

dharrigan12:06:03

(defn string->map
  [message]
  (json/parse-string message true))

Ben Hammond09:06:46

if its the threading sympob in as-> macro I often call it <az->> to make it bleeedin obvious that this is not a normal variable

Ben Hammond09:06:54

(as-> 1 <az->>
  (+ <az->> 2))

😱 4
Ben Hammond09:06:28

otherwise I''d ffavour alphanumberic only

djtango09:06:48

we've used $ for as->

djtango09:06:12

would be nice if you could use %

Ben Hammond09:06:14

even underscores and hypen are to be treated with suspicion because of how they interop wih json and graphql

Ben Hammond09:06:29

I think you can

djtango09:06:56

oh wow TIL

djtango09:06:38

though maybe could be ill-advised :thinking_face:

djtango09:06:13

could be mystifying to a beginner, and presents pitfalls if you were ever to use as-> within a function literal #( ...)

Ben Hammond09:06:38

eugh. would you ever do that?

Ben Hammond09:06:45

with a clean conscience

djtango10:06:19

I guess not

practicalli-johnny11:06:27

I hope this is a joke library... and you are only kidding about using it...

practicalli-johnny15:06:26

I saw the video and am relieved you were πŸ™‚

Ben Hammond10:06:46

non-trivial threading is usually a sign that your function has grown too large

Ben Hammond10:06:51

and needs breaking up

guy10:06:01

^ i would tend to agree with that haha

Ben Hammond10:06:12

peoply get seduced by "One threading statement"

Ben Hammond10:06:30

but you end up with code that is really hard to maintain

dharrigan10:06:27

I only recently read about as-> and was like wow

Ben Hammond10:06:56

I don't find it to be terribly useful

guy10:06:03

i again tend to agree haha

guy10:06:06

I’ve seen it once

guy10:06:19

its like a specialist fn/macro in my opinion

dharrigan10:06:44

I haven't used it yet, I'm more like wow that's possible...if I need it πŸ™‚

dharrigan10:06:06

The more I learn about clojure, the more I wish it had conquered the world πŸ™‚

Ben Hammond10:06:27

there's quite a hangover that comes when you have to figure out how to safely modify and refactor the code that is already running in production

Ben Hammond10:06:05

and there's no static compiler to helpfully point out your keyword typos

πŸ‘Œ 4
Ben Hammond10:06:44

(and you realise why people bang on about simulation and generative testing)

danielneal10:06:04

I've been doing clojure for ages and I'm still a long way away from the change in paradigm to modifying/refactoring code. The talk on speculation was really interesting, in that respect. I'm trying now to aim for accretive change, even when refactoring. Writing new functions function2 rather than changing old functions; adding new keys with clearer meanings rather than changing existing keys...

danielneal10:06:23

when I did C# I tended to change the thing at the bottom and then follow the compiler warnings

alexlynham10:06:54

yeah I tend to do a similar thing in clj

alexlynham10:06:26

though I hadn’t thought about it until you said then…

djtango10:06:57

curious how you've found the impact of accretive changes on your codebase

djtango10:06:13

do you end up with a growing mess of functions that do similar things?

djtango10:06:41

(I suppose with docstrings and names like f-v2 it hopefully becomes clear to new maintainers which thing to use)

danielneal10:06:05

It's early days in this approach. Because It's internal, I can remove old functions when they're no longer used anywhere

alexlynham10:06:41

I think ideally you do one day remove functions unless you’re a library maintainer and cannot

djtango10:06:30

so basically deprecate, migrate then cleanup

danielneal10:06:54

In theory 😁

djtango10:06:32

our codebase at work quite literally has 3 year old comments saying "delete me in two days time" πŸ˜‚

danielneal10:06:49

Haha classic

bronsa11:06:23

;; TODO: temporary hack

πŸ™ˆ 4
❀️ 12
danielneal11:06:49

my entire life

seancorfield14:06:37

In pull request reviews we require TODO be replaced by a Jira ticket number, so at least it is recorded as technical debt in the system.

❀️ 8
danielneal14:06:06

that's a good idea πŸ™‚

danielneal11:06:22

this is where they introduce it

danielneal11:06:21

I think it's more than a joke, it's more like performance art.

practicalli-johnny11:06:54

Phew... I was a little worried...the video make it clear its a joke πŸ™‚

danielneal11:06:28

I have my suspicions there's a kernel of truth in there though

practicalli-johnny11:06:54

now I am distracted watching the rest of the video... its really funny...

danielneal11:06:38

"this is the bread and butter of our codebase"

practicalli-johnny11:06:07

or the vegan alternative "humous and quinoa of our codebase"

practicalli-johnny12:06:30

Speaking of great talks, we will be inviting some people to speak at ClojureX so let me know if you have anyone you would like to see - its given that we all would like Rich Hicky πŸ™‚

danielneal12:06:07

There was a reddit thread of clojure heroes recently

danielneal12:06:12

any of those would be great imo

danielneal12:06:32

has the call for proposals gone out already?

danielneal12:06:53

nice πŸ™‚

practicalli-johnny14:06:26

No heckling allowed this year, it's a family show and we have 10 year olds attending (as in chronological age, not iq).... unless your are heckling words of love.... Otherwise please heckle outside of the conf

yogidevbear14:06:39

Sounds like you're heckling those with an iq of 10 years old but are chronologically much older πŸ˜‰

jasonbell15:06:22

@U05254DQM We’ve discussed this before, I’m 47, not 10 πŸ™‚

jasonbell15:06:22

It was heckles of love and encouragement last year.

practicalli-johnny16:06:48

In all seriousness, we do have one member of London Clojurians community who is 10 years old cronologically and will be coming to the conference.

πŸ‘ 8
practicalli-johnny16:06:16

I managed to convince Ray McDermot not to swear on stage last year, so the family show is on track. Thanks.

πŸ™‚ 4
thomas08:06:50

Me.... never????

yogidevbear13:06:06

I'm innocent, I swear it

yogidevbear13:06:34

Oh wait, at ClojureX, yeah sure thing πŸ˜‰

yogidevbear13:06:57

But just for you ❀️

jasonbell13:06:43

I’ve nothing planned. I could talk about DeskHoppa and that’s about it. I don’t think anyone is really that interested in Kafka pain which is where most of my time is now.

jasonbell13:06:17

Saying that I’ve not put a proposal in and declined every other talk invite this year.

maleghast13:06:54

@jasonbell - I'll heckle you if you promise to heckle me... πŸ˜‰

jasonbell14:06:16

Ah blockchain heckling @maleghast need proof of heckle.

seancorfield14:06:37
replied to a thread:;; TODO: temporary hack

In pull request reviews we require TODO be replaced by a Jira ticket number, so at least it is recorded as technical debt in the system.

❀️ 8
maleghast14:06:29

That's a really great idea that I am going to steal, @seancorfield

seancorfield14:06:21

Sometimes just the pressure of creating a Jira ticket is enough to make the dev go back and fix it properly in the first place 😁

πŸ˜‚ 12
πŸ‘ 8
Ben Hammond14:06:40

I usually find that those 'long term' JIRAs get quietly closed by management desperate to > tidy up the board

seancorfield14:06:12

Doesn't happen here. Management understand "technical debt". We've trained them well 😁

πŸŽͺ 4
Ben Hammond14:06:48

was verify a clojure project?

Ben Hammond14:06:00

wasn't there clojure somewhere in gds?

Ben Hammond14:06:10

am I misremembering?

practicalli-johnny14:06:23

No Clojure at GDS that I am aware of. They did sponsor a ClojureBridge London event though.

Ben Hammond14:06:22

I thought someone did a clojurex presentation ~4 years ago about clojure in hmg

Ben Hammond14:06:13

kris jenkins or phil potter

Ben Hammond14:06:52

actually perhaps his parting shot from that talk was > we got shut down

practicalli-johnny14:06:40

Back to the usual channel topic, have you been following Lord of the Rings - the Guinea pig cut? https://twitter.com/jr0cket/status/1141354075281416192?s=19

dharrigan15:06:09

Anyone using clojure with protobuf?

yogidevbear16:06:29

@U11EL3P9U JUXT is working on a client project that uses protobuf. @U899JBRPF would be able to tell you more about it though. Do you have any particular questions?

dharrigan18:06:27

Oh, just looking for recommends in terms of libraries to use.

dharrigan18:06:25

This one looks to be the most maintained:

yogidevbear18:06:18

I can take a look a bit later and see if any particular libraries jump out at me from that project. Jeremy was more involved with the initial stages on that particular project and had to deal with the more complicated bits of initial setup so would probably be better positioned to make recommendations or point out any particular pain points

refset22:06:31

Hi πŸ™‚ unfortunately I don't think the client has open-sourced that component of their project yet, but I remember them saying they intended to. I haven't studied the code enough to judge it myself but I gather it's a very simple and effective solution vs the other options. I'll ask if they're still interested in open-sourcing it next time I speak to them! (sorry I can't be more helpful...maybe I can get them to chime in directly)

dharrigan09:06:39

That is helpful! πŸ™‚

practicalli-johnny16:06:25

The project I worked on at a certain bank use protobuf for the data the client apps generated and our Clojure system processed. It felt like a bit of a necessary evil (as we didnt have kafka at the time).

zyxmn17:06:34

In ring handlers , what is it that makes them asynchronous? I don't get the control flow .

seancorfield17:06:14

@zyxmndaleyjes There are two different arities for handlers. The single arity is synchronous. The multi-arg arity is used for asynchronous behavior, where the handler is passed success/failure functions and calls those when it is done. The actual asynchrony comes from the adapter used to call into the handlers (as I understand it).

zyxmn17:06:23

@seancorfield cheers, so the success/failure function you mentioned that is fed to the handler runs in a different thread ?

seancorfield17:06:44

I'd have to go digging in the docs/source to answer that...

🍿 4
πŸ™‚ 4
seancorfield18:06:20

...like I say, I believe it's controlled by the adapters somehow. I've never actually used Ring in async mode.

zyxmn18:06:31

ah okies , thanks a lot

zyxmn18:06:42

I was just wondering what happens if you chain async handlers

yogidevbear18:06:39

@zyxmndaleyjes test it out and report back here with your findings please πŸ˜‰

seancorfield18:06:40

My answer to that would be "try it and see!" πŸ™‚

seancorfield18:06:47

Jinx! :rolling_on_the_floor_laughing:

πŸ˜‚ 4