This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-17
Channels
- # beginners (42)
- # cider (1)
- # cljs-dev (20)
- # clojure (73)
- # clojure-italy (8)
- # clojure-nl (53)
- # clojure-spec (11)
- # clojure-uk (88)
- # clojurescript (170)
- # clojutre (6)
- # core-async (26)
- # css (2)
- # cursive (13)
- # data-science (10)
- # datomic (15)
- # editors (3)
- # figwheel (28)
- # figwheel-main (67)
- # fulcro (57)
- # graphql (2)
- # immutant (2)
- # jobs (1)
- # jvm (4)
- # lein-figwheel (3)
- # leiningen (1)
- # off-topic (5)
- # pedestal (28)
- # re-frame (86)
- # reagent (18)
- # reitit (8)
- # ring (3)
- # ring-swagger (2)
- # shadow-cljs (78)
- # spacemacs (10)
- # specter (12)
- # tools-deps (32)
- # vim (3)
looking for critique of the approach taken here: https://gist.github.com/uwo/9a6de35d17c73337ffde3dc2c5f53c54 Any feedback welcome
I dunno, I suspect want you might actually want is some kind of parallel fold over the tree
the whole done function and it usage is more callbacky then I like to see, the whole point of core.async's go macro is to try and eliminate those
core.async is really about building stateful machines that communicate, if you just want parallel data processing, reducers or maybe using forkjoin directly might be better
it looks like you are feeding a bunch of stuff into the pipeline to be run in parallel, but then getting the "done" time when the first thing is complete, which likely isn't what you want
previously I was returning a single accumulation on the channel, but the process we need is just going to write to another system in xf!, hence the dropping-buffer just to drain the output. I had seen a pattern like that (dropping the output of to
on the floor in datomic’s tx-pipeline example
I totally agree on core.async empowering us to remove callbacks. I was trying to contain core.async code in a manner that tbaldridge suggest in this talk, and one of his suggestions is hiding the implementation behind a callback. Not everyone on my team is comfortable with core.async (hehe. not that I’m comfortable clearly!)
whoops. the mentioned talk https://youtu.be/096pIlA3GDo?t=909
I would love an opportunity to use fork/join;reducers, unfortunately in this case I have a stream of info that can’t fit into memory (1st issue), and the transducer passed to pipeline-blocking has to do IO. I was under the impression that reducers were for computationally expensive work only, am I off here?
it won't work if there's false
on the channel being drained
you can use when-some
rather than when to explicitly check for nil
also, minor style nitpick, you never need _ bindings at the end of a let binding block - you can just move things done for side effects down into the body
done can be replaced with take!
which already exists and does the same thing
generally take! without the callback can replace a go block that consumes from a chan but doesn't care about the value, and with the callback can replace a go block that only exists to do something to one value on a channel
(fixed for accuracy)