This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-23
Channels
- # announcements (6)
- # aws (4)
- # babashka (66)
- # beginners (70)
- # calva (2)
- # cider (62)
- # clara (1)
- # clojars (5)
- # clojure (101)
- # clojure-dev (67)
- # clojure-europe (1)
- # clojure-nl (3)
- # clojure-uk (13)
- # core-async (15)
- # datomic (11)
- # defnpodcast (10)
- # duct (22)
- # emacs (6)
- # events (1)
- # fulcro (34)
- # kaocha (3)
- # off-topic (20)
- # pathom (1)
- # re-frame (8)
- # reagent (14)
- # remote-jobs (1)
- # shadow-cljs (58)
what’s the best way to tack on a transducer on to existing channel
this seems to come up a lot for me… I have a function that returns a channel and I want to add a partition operation to it
one way is to make a new channel with that transducer and use pipe
to move items from one channel to other
I’d love to use pipeline
but that seems to consider each item individually in paralel so I don’t know how it plays with the partition operation
What's the best way to implement debouce/throttle on a channel? As a custom buffer? A transducer? or a go process? I found a few implementations online but am wondering if it logically belongs in one of these more than the others
Not sure if that matters, but a transducer may be executed on a take or on a put, see https://stackoverflow.com/questions/34847872/how-are-transducers-executed-in-core-async-channels
Also this talk is a good watch if you want to understand the internals: https://vimeo.com/100518968
you could also make your own channel implementation similar to what kinksy is doing in its duplex
channel: https://github.com/pyr/kinsky/blob/a5309073264a1d319d9303a839d9606331560212/src/kinsky/async.clj#L10
a few questions for you to ponder about: do you want to throttle on put or on takes? do you want this behaviour to be totally transparent to clients using your channel? which sides or who configures the throttling and how?
oh and are throttling parameters fixed for the duration of the channel or do they need to change during its life?
I'd try first to get by composing existing building blocks: timeout channels, stateful transducers, etc
many of those examples are written before transducers existed btw