This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-10
Channels
- # announcements (3)
- # babashka (3)
- # beginners (83)
- # calva (1)
- # cider (19)
- # clojure (131)
- # clojure-austin (4)
- # clojure-dev (3)
- # clojure-europe (49)
- # clojure-greece (2)
- # clojure-italy (8)
- # clojure-losangeles (18)
- # clojure-nl (14)
- # clojure-poland (1)
- # clojure-uk (65)
- # clojurescript (28)
- # core-async (7)
- # core-logic (3)
- # cursive (2)
- # data-science (1)
- # datomic (98)
- # defnpodcast (1)
- # figwheel-main (6)
- # fulcro (95)
- # graphql (5)
- # hoplon (7)
- # kaocha (1)
- # lein-figwheel (6)
- # luminus (1)
- # nyc (1)
- # off-topic (21)
- # pedestal (1)
- # quil (8)
- # re-frame (15)
- # reagent (106)
- # reitit (15)
- # shadow-cljs (158)
- # sim-testing (1)
- # spacemacs (17)
- # sql (25)
Been watching Core Async talk given by Rich at Strangeloop 2013. Very interesting - an area I need to look further into.
We use core.async a LOT at work in a couple of apps... but not the apps I work on π
I realise that using tradtionally
instead of tradtional
in my comment probably made you say > WAT?
what dyu mean @dharrigan "threads as well" ?
I think I would do a disservice by trying to explain in my own words, Rich's talk goes into it π
easy now
I've worked in a few projects where folk have gone crazy with core.async
sure its fun at the time, but
Please Won't Somebody Think Of The Maintainers
I've used core.async in web front end stuff (with Om) where I was reasonably happy with it. I used it to create some data pipelines for another thing (which I can't open source directly annoyingly) where I was very happy with it. I liked the way it structured the flow of data and being able to put transducers onto channels and mults to move things to different areas to make different data products made me very happy.
the data pipeline didn't have any concurrency, but lots of embarrassing parallelism in the different data products, but with lots of partially shared bits of processing
I think its killer feature is backpressure
you can bring the whole line to a halt if you cannot keep up
rather than building up a memory aneurysm that will pop
sometimes you'd rather have an OOM just now
than wonder in 5 minutes why its ground to a halt
(and of course tracing which bit of a long pipeline has ground to a halt can be a right pain in the arse)
I think, for me, at the moment, my understanding is the intention - if my program is the one that is initiating a call to an external resource (db/web), then putting that call in a thread seems okay. If, on the other hand, I want my program to react to external events, i.e., listen for incoming connections, things coming from external systems, then putting that in go blocks and into channels is better
(future
(loop []
(when-let [vehicle-ids (find-vehicle-ids-with-missing-vrns)]
(when-let [vehicles (vehicle-client vehicle-ids)]
(update-vehicles-with-vrn-and-vin vehicles)))
(Thread/sleep 10000)
(recur))))
the find-vehicle...
and vehicle-client
are 1. a database lookup and 2. a REST call.
So, putting that into a thread (future) that just ticks around in the background whilst my program gets on with other stuff (consuming from kafka and doing calculations) feels okay.
@ben.hammond @dharrigan the stream-processing model is just very simple and explicit - backpressure and and buffer-size between them give you a remarkable amount of control
That's okay (I believe) as the update doesn't have to update all vehicles in one go, a next loop around will pick up missing details again and fill in missing - it keeps going - if it fails (per loop), not an issue.
> between them give you a remarkable amount of control
very much agree, but requires experience and self-control to use wisely
comes back to running with sharp tools
if
(vehicle-client vehicle-ids)
tolereated a nil vehicle-ids
input, by returning an immediate nil response
you could collapse one of your (when-let
clauses
just sayin'you could separate out the timer/loop logic and any i/o logic from any data transformation logic too - then it would get more testable
> Mr Trump said: "The woman was driving on the wrong side of the road, and that can happen. > > "You know, those are the opposite roads, that happens. I won't say it ever happened to me, but it did.
We were nearly in a full frontal crash on a small country road in the Cotswolds last year. An American elderly couple came around the corner in their rental car doing ~50mph, on the right (wrong) side of the road and nearly crashed into us. We both stood on the breaks and managed to avoid a crash with maybe a metre to spare. He apologised profusely of course, but I was not happy. I glared and tutted at him to his face.
We were nearly in a full frontal crash on a small country road in the Cotswolds last year. An American elderly couple came around the corner in their rental car doing ~50mph, on the right (wrong) side of the road and nearly crashed into us. We both stood on the breaks and managed to avoid a crash with maybe a metre to spare. He apologised profusely of course, but I was not happy. I glared and tutted at him to his face.
how long does 50 pence last you?
what happens to all the 50 pences? does that meter have to get emptied manually? is there vacuuum tube directly to the centre of the earth, where they get melted down?
do they drop out into a bucket so you reuse them?
can you take a fret saw and hollow them out?
cut out a 20 pence stencil from inside the 50 pence
hehe. TopCat
style, attach some thin wire to the coin so that you can retrieve it from the meter
@ben.hammond Re: diplomat crash. I do think it's fairly instructive to consider how you (general sense) would handle this situation. I think it is all too easy to expect saintly behaviour from people but it can't be that easy to volunteer for a prison sentence. I am sure any defence lawyer, paid to keep their client out of prison, even if they are guilty, even if they are maliciously guilty (not applicable here), would see the diplomatic immunity loophole and say, "why are you still here?!". Trump obviously can't wave diplomatic immunity, and neither would Obama (or Clinton had she won). Far too "precedent setting". Perhaps for premeditated murder, but they obviously wont risk jeopardising the notion of diplomatic protection over this (even if it should be 'jeopardised'). To my mind we are in this odd situation where the woman wont be going to prison no matter what happens, because honestly, if she came back, fully of her own accord to "face the music" when she didn't have to, I'd call that an act of fairly extreme selfless high morality, and suggest that she should probably be treated quite leniently in response. If she doesn't come back, then... well... As it turns out, the criminal justice system only really makes sense when defendant don't really have a, "nah, rather not!", option.