This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-07
Channels
- # announcements (12)
- # aws (2)
- # beginners (233)
- # calva (68)
- # cider (23)
- # circleci (5)
- # clj-kondo (40)
- # cljsrn (4)
- # clojars (3)
- # clojure (200)
- # clojure-austin (1)
- # clojure-canada (1)
- # clojure-dev (16)
- # clojure-europe (1)
- # clojure-finland (1)
- # clojure-italy (4)
- # clojure-nl (16)
- # clojure-spec (3)
- # clojure-uk (102)
- # clojurescript (16)
- # cursive (14)
- # datomic (16)
- # figwheel-main (7)
- # graalvm (3)
- # hoplon (37)
- # jackdaw (23)
- # jobs-discuss (24)
- # joker (4)
- # kaocha (6)
- # keechma (64)
- # off-topic (66)
- # parinfer (1)
- # pedestal (7)
- # re-frame (7)
- # reagent (10)
- # reitit (45)
- # rewrite-clj (12)
- # shadow-cljs (1)
- # slack-help (8)
- # spacemacs (55)
- # sql (9)
- # tools-deps (9)
- # vim (7)
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.
@ben.hammond your little snippet compiles nicely as a graal native image š
oh dear. I'd have spent a bit more time polishing it if I would have known
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)
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 (java.net.ServerSocket. 8084)]
(dotimes [n 2]
(let [cs (.accept ss)]
(with-open [br ( (.getInputStream cs))]
(println (slurp br))))))))
ah forgot about slurp
very nice
I guess that will only print after the client socket has EOF'd ?
(which is probably good enough ?)
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
).
yeah I'm with you on that
(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.
haha,
then I worked alongside one of the cognitect guys and he taught me use reduce
as the magic hammer
but I try to refrain when I see nil
getting used a a permanent accumulating value
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.
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.Morning All; Bore da; Bonjour, Guten Tag, Bonjourno, Kali Mera (no Greek characters easily accessible to me right now) etc. etc.
Labas rytas
morning
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 https://github.com/riverford/objection (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
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 š
https://www.reddit.com/r/Clojure/comments/7if66b/objection_another_component_alternative_is_this_a/
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.
@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
@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 š
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 š
For me, the best thing when I get to work from home, is actually having a nap at lunchtime
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.
What was that Jade? I couldn't hear you over the noise in the background š
@jasonbell Haha, true!
@metacritical Sadly it is.
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