Fork me on GitHub

And good morning 🙂


@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

@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


I polished 🙂


(not that it needed anything much)

👍 4

hey guys, look at this, BBC being awesome (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

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


I’m so confused :D thanks @U05254DQM


Its Friday... give yourself a break 🙂


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


@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 ( 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 ?)


I can try both 🙂


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)


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


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


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


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

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

(def f2 (future
          (dotimes [n 2]
            (with-open [ss ( 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.


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


jo reggelt


Well, today I discovered mount


which is very helpful


integrant is much better 🙂 (IMHO)


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.


Anyone tried (my colleague wrote it; I think it solves some interesting problems in that space)


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


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


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

🙂 4

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


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


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


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: 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.


@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.


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.


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.


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.


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


you've heard of us? 🙂


we have a clojure team, who would have imagined 😄


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?


yeah, these are react native via cljs


they're served by a graphql api in clojure


but not everything is clojure


we have a legacy site which is magento/php


and a new site on the way which is node based


clojure has helped us glue all these bits together


Cool, thanks 🙂


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


it suddenly tasted a lot better 😉


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


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


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?


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


metal team remote ftw


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


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


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


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.


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


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


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

😂 8

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


I finish really early when I wfh


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


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.


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 🙂


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


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...).


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


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)


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


Though on the contrary Starbucks noise becomes white noise.


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


Also not cold.


<<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

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


@yogidevbear Who is this Jade you speak of?

🤷 4
🙂 4

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)