Fork me on GitHub
#clojure-uk
<
2019-06-07
>
yogidevbear06:06:26

And good morning 🙂

yogidevbear06:06:03

@shan Thanks for sharing that video on for and list comprehension the other day. It was really good. Think I'll give some of Misophistful's other videos a watch too.

👍 4
dharrigan07:06:38

@ben.hammond your little snippet compiles nicely as a graal native image 🙂

Ben Hammond07:06:25

oh dear. I'd have spent a bit more time polishing it if I would have known

dharrigan07:06:46

I polished 🙂

dharrigan07:06:55

(not that it needed anything much)

👍 4
3Jane07:06:02

hey guys, look at this, BBC being awesome https://twitter.com/jesslynnrose/status/1136266421099552769 (ugh... just realised I misread it and this was 5th June not July, but ... might still be worth applying as it's only 2 days past)

👍 8
practicalli-johnny13:06:10

It says 5th July on the website (maybe they changed it)

3Jane13:06:53

I’m so confused :D thanks @U05254DQM

practicalli-johnny14:06:19

Its Friday... give yourself a break 🙂

dominicm07:06:31

@agile_geek when you were writing your circleci tutorials, how did you keep your changes "straight" throuhgout edits?

rickmoynihan08:06:19

@ben.hammond I forgot to complement you on your cute snippet btw :thumbsup: … I offer the following spit and polish. cc @dharrigan.

(def f2 (future
          (with-open [ss (java.net.ServerSocket. 8084)]
            (dotimes [n 2]
              (let [cs (.accept ss)]
                (with-open [br ( (.getInputStream cs))]
                  (println (slurp br))))))))

Ben Hammond08:06:35

ah forgot about slurp

Ben Hammond08:06:42

I guess that will only print after the client socket has EOF'd ?

Ben Hammond08:06:05

(which is probably good enough ?)

dharrigan08:06:26

I can try both 🙂

rickmoynihan08:06:33

Yes, that’s a good point. Well spotted. Might be a reason to prefer your way 🙂 Though generally I tend to prefer consuming lines like you did for stuff where you may expect a large input; but slurp is probably sufficient for a hack like this. Other main difference is stylistically I personally prefer being explicit about side effects and not putting them into sequences, and having to hack them to be eager later, e.g. with mapv. Especially in cases like this where the sequence isn’t capturing anything meaningful (`(.accept ,,,)` just returns nil).

Ben Hammond08:06:07

yeah I'm with you on that

Ben Hammond08:06:34

(I'm a stranger to dotimes as well)

rickmoynihan08:06:39

there’s a bunch of doXXXX macros that are worth acquainting yourself with. If you’re processing effects they make the intent much clearer.

rickmoynihan08:06:22

When I first got into clojure I used to think of sequences as a magic hammer, and view everything that way to make it “more functional”. It was a fun exercise, but I think it obfuscates things; especially if you don’t care for the result.

Ben Hammond08:06:00

haha, then I worked alongside one of the cognitect guys and he taught me use reduce as the magic hammer

Ben Hammond08:06:23

but I try to refrain when I see nil getting used a a permanent accumulating value

Ben Hammond08:06:02

reduce is just a sugared-up loop anyway

rickmoynihan08:06:04

yeah reduce can certainly be a magic hammer; subsuming all loops an’all

rickmoynihan08:06:39

but it’s better to prefer the right form to communicate what the job being done is. When everything is just a map or a reduce all meaning is lost.

👍 4
rickmoynihan08:06:35

It’s also worth mentioning you can write it this way:

(def f2 (future
          (dotimes [n 2]
            (with-open [ss (java.net.ServerSocket. 8084)
                        br ( (.getInputStream (.accept ss)))]
              (println (slurp br))))))
As with-open can take multiple binding forms. However doing so here will cause the socket to stop listening after each connection. So it’s arguably less correct; but again probably sufficient for a hack.

maleghast08:06:02

Morning All; Bore da; Bonjour, Guten Tag, Bonjourno, Kali Mera (no Greek characters easily accessible to me right now) etc. etc.

benedek10:06:22

jo reggelt

dharrigan10:06:04

Well, today I discovered mount

dharrigan10:06:24

which is very helpful

rickmoynihan10:06:38

integrant is much better 🙂 (IMHO)

dominicm10:06:01

Mount is easy, but I think it has a negative side effect on the style of your code. But this discussion is very played out.

danielneal10:06:50

Anyone tried https://github.com/riverford/objection (my colleague wrote it; I think it solves some interesting problems in that space)

alexlynham10:06:58

if your app is teeny (like a microservice) then maybe mount would work better, esp if you have devs new to clj… otherwise I’d go for integrant

danielneal10:06:53

approach should feel familiar if you've used the spec registry, or even just ps

dominicm11:06:49

I thought it was very cool, could do with some more love I guess :)

🙂 4
danielneal11:06:24

yeah no-one seems to have really noticed it although I think tim baldridge liked the idea

rickmoynihan12:06:39

I completely missed this one… Are there links to the tim baldridge discussion?

danielneal12:06:49

haha wasn't so much of a discussion more just an encouraging comment 🙂

rickmoynihan12:06:18

hmm looks interesting. I’ll need to look at it properly… What I like about integrant is that it makes it very easy to override config values etc; without messing with code. Typically config is edn. And an integrant treats a system itself as a first class value; which means you can have as many as you want. Typically I like to have the option to run two simultaneously; one for dev and one for tests; in the same REPL. I don’t yet understand objection; but the one thing that’s niggling me is having a global registry: https://github.com/riverford/objection/blob/39e9934ce5bdf27d4f914ebf40dede364fd89974/src/objection/core.cljc#L26-L33 I’d typically much rather define that var myself in my app… though I guess you can partition inside it. I’ve no idea yet whether this concern of mine is well founded.

danielneal12:06:01

@U0GE2S1NH might be able to explain further, but we definitely started off with an integrant system, but there came a point when it just got too unwieldly for the kind of things we were doing.

rickmoynihan12:06:08

integrant certainly presents a very static view of the system… and sometimes you need to augment the construction of the system with other things. but we’ve got some pretty large integrant systems; and it’s holding up ok.

wotbrew13:06:13

I was messing with creating 'subsystems' at runtime, they did not have global names (e.g in integrant you really know ahead of time what is the extent of your system) I think multiple threads were involved and really integrant didn't help me do that at all. Also, lets say you start a system or component with integrant/component, and you lose the reference to your live system, say at the REPL. That can be a problem right? Because you have this aspect of your system which is live, and possibly destructive, and the garbage collector is not going to help you - so what do you do, stop the REPL. The global registry and the ability to address components without direct references to them helps with this. You still have the ability to have as many unique components and system instances as you want, e.g for testing.

wotbrew13:06:05

The idea is that your functions that construct objects have this global quality (e.g they have a life of their own, or acquire and hold on to resources), register those objects internally. So you call (start-server db) n times and you get n servers, each one is tracked so you can address them later, the db relationship is tracked so that if the database closes then the dependent servers close. Really every time you start something like a server, you are acquiring resources globally, so I don't see the tracking in the registry as giving up much at all.

thomas11:06:37

@danieleneal is that riverford as in the company that does veg boxes?

danielneal11:06:04

you've heard of us? 🙂

danielneal11:06:25

we have a clojure team, who would have imagined 😄

dotemacs11:06:32

Cool. Is your whole stack in Clojure? I ask, since I see that you have apps in iOS & Android so figured, react-native via Cljs?

danielneal11:06:55

yeah, these are react native via cljs

danielneal11:06:09

they're served by a graphql api in clojure

danielneal11:06:17

but not everything is clojure

danielneal11:06:24

we have a legacy site which is magento/php

danielneal11:06:03

and a new site on the way which is node based

danielneal11:06:25

clojure has helped us glue all these bits together

dotemacs12:06:15

Cool, thanks 🙂

thomas12:06:19

very cool indeed. When we lived in the UK we got the box ones a week. really nice

thomas12:06:38

it suddenly tasted a lot better 😉

dominicm13:06:48

@danieleneal I know Dan from ages ago. How many people are you at riverford now?

danielneal14:06:05

We're a pretty sizable IT team now - 9 of us on the engineering team of which 4 do Clojure or ClojureScript

dominicm14:06:27

That's awesome. I remember when Dan went in and was trying to get the Clojure migration started. Are you all on site, or remote?

danielneal14:06:00

i've just gone remote, I'm an experiment 😂

alexlynham14:06:56

metal team remote ftw

danielneal14:06:09

😂 I'm guessing you're remote @alex.lynham - how do you find it?

alexlynham14:06:04

I’m on month errrrrm 4(?) of being remote now

alexlynham14:06:26

it took some major getting used to at first, but now I’ve adjusted I’m definitely won over

alexlynham14:06:29

in reality I end up going to a shared working space 3 days a week, but when the people you’re with 7-9 hours a day aren’t working on the same thing as you it’s… different. In a good way.

alexlynham14:06:51

you get the social structure of ‘now is work time’ without a lot of the distraction

danielneal14:06:43

Yeah, I've found a really cool shared working space which is nice. Definitely missing the Riverford lunches though 😂

Conor14:06:04

The best thing about working from home is playing computer games at lunchtime

😂 8
dharrigan14:06:06

For me, the best thing when I get to work from home, is actually having a nap at lunchtime

dominicm15:06:13

I finish really early when I wfh

seancorfield15:06:08

I've worked almost 100% remote for over a decade now.

seancorfield15:06:17

In the middle of that, I had a short gig that was on-site 3-4 days a week but it was only a 20 minute car ride (outside normal commute hours!) and I car-pooled about half that time anyway.

seancorfield15:06:23

I think the biggest downside is getting a bit lonely. I mean, I have the missus and the cats, but it's not the same dynamic as shooting the breeze with colleagues. Thank goodness for Slack, is all I can say about that 🙂

mccraigmccraig15:06:41

i've also been remote for most of the last decade - i haven't found any downsides yet

seancorfield15:06:27

But there are some massive upsides: the amazing flexibility with time and tasks -- I can run cats to the vet or go shopping pretty much any time during the day, and work my own hours. We have a daily engineering standup in the morning and only a couple of other standing meetings so as long as I make those, no one really cares whether I'm at my desk or not -- as long as stuff gets done in a timely manner (and I'm very productive when I'm actually working so...).

metacritical15:06:56

I have found that i can be extremely productive in my own cosy place of work compared to the ritualistic office scenario.

alexlynham15:06:19

I tend to find work comes in bursts of flow so 30mins can be sometimes more productive than entire days (but then you don’t know how much of the time sitting at the desk was your subconscious doing the heavy lifting I suppose)

metacritical15:06:14

True, plus there is a lot of visual and audio disturbances in open offices these days.

metacritical15:06:36

Though on the contrary Starbucks noise becomes white noise.

alexlynham15:06:42

just being in a calmer place where your brain can meander is good

metacritical16:06:07

Also not cold.

jasonbell16:06:13

<<Though on the contrary Starbucks noise becomes white noise.>> But it’s not white noise to anyone that needs to do a call with you. It’s one of the most distracting things I’ve found when talking to devs working in cafes.

👍 4
yogidevbear16:06:22

What was that Jade? I couldn't hear you over the noise in the background 😉

jasonbell16:06:28

@yogidevbear Who is this Jade you speak of?

🤷 4
🙂 4
practicalli-johnny16:06:09

I am discussing solutions to 4Clojure #39 in Saturdays broadcast (10am UK time) and doing my first live run with the OBS studio software (could be all sorts of fun) https://www.youtube.com/watch?v=DUaWknJU-zY