This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-02
Channels
- # beginners (61)
- # boot (84)
- # cider (43)
- # cljsrn (2)
- # clojure (99)
- # clojure-android (3)
- # clojure-austin (2)
- # clojure-italy (5)
- # clojure-russia (43)
- # clojure-spec (93)
- # clojure-uk (41)
- # clojurescript (94)
- # clojutre (1)
- # cloverage (8)
- # core-async (31)
- # cursive (3)
- # datomic (14)
- # defnpodcast (1)
- # editors-rus (7)
- # events (1)
- # hoplon (15)
- # leiningen (3)
- # luminus (6)
- # om (142)
- # onyx (86)
- # other-languages (4)
- # pedestal (1)
- # planck (1)
- # portland-or (5)
- # re-frame (96)
- # reagent (16)
- # ring-swagger (17)
- # rum (73)
- # specter (25)
- # untangled (14)
- # yada (142)
Hi all, is there any way of telling pipeline how to distribute inputs inside the pipeline? Basically I have a pipeline where I want to make sure that items with a specific key always go to same thread/go block to make sure they're not processed out of order
Other than using 1 thread :)
The results are guaranteed to be in the same order as the inputs but that doesn't say anything abut the processing order
Glad to know there's a special core-async group. A bit basic question, is it possible to do a parking take. There is to say, I will recur the loop when I've put something on a channel, but at another channel I will take from within the body, only if there's something to take. I tought about timeout, but in my case I can't really lose a millisecond, is this possible at all?
I dont have any example, I'm temted to use atom (dereference it in the go-loop body), but I'm afraid it will hit me back in the long run.
have you looked at offer! and poll! ?
they give you the “do if you can but return if you can’t” behavior
I don't entirely follow what you are trying to do, but the pair of <! and !> both park inside the go macro
nice! offer rhimes with what I want. @hiredman doesnt go macro return a channel that I would in the end have to block to take out of?
the go macro returns a channel that will have the result of the expression put in it, but you don't have to use that channel at all
My idea was to use the recursion to take care of my state problem. I can see a go macro within a go-loop useful in case of side effects ie. dont care about the return value, but I may be wrong, just thinking out loud to be proven wrong 🙂
I think offer! makes what you asked a little more clear to me. you have a producer writing to a channel, and you have a consumer reading from the channel, and you don't want the producer to be blocked writing to the channel if the consumer is running behind the producer?
Good point I should have mentioned, the consumer cant be blocked (actually its a audio signal, if it would the audio could stop). So I basically want to send commands to audio signal in a go-loop (44,1k per second) without blocking even for a ms. Reading the clojure docs
poll! Takes a val from port if it's possible to do so immediately.
Never blocks. Returns value if successful, nil otherwise.
sounds like what I want.if a go-loop is running constantly for a long time, would it help performance wise in putting it in async/thread?
@hlolli the go-loop is running in a fixed thread pool (presuming clojure not clojurescript), the only time “performance”-wise it should matter is if you are actually having work trying to be assigned to all of the threads in that thread pool from other go blocks, since a long running task would have it take that thread and prevent other work from being done. If you do want your long running stuff to happen in addition to anything else being fired in a go block, than you can not use go-loop
at all and just do a recur
on a thread (created via async/thread or a future) and let the OS assign when to switch work from that thread to other things coming up
ah ok, I can see when that can be useful, as well as I can see that thread is not what I want for my usecase. thanks for a good reply @tanzoniteblack.
I’m actually kind of curious to see how what you’re working on goes; I’ve never considered using core.async for something that needs as low latency as audio processing
actually that’s more of a statement about clojure/jvm and low latency operations than core.async
though I know https://github.com/overtone/overtone/ has done pretty well, but I kind of assumed most of the actually sound code was in the supercollider side of things
yes, I started with supercollider then overtone and then I did this https://github.com/hlolli/panaeolus now I've worked full time as clojure developer for over half a year and I want to rewrite it again. Im actually only working with control signals not actually 44,1k per second.
🙂 I was just reading through that (useful that you re-use hlolli on github)
I imagine using more complex algorithms for each musical pattern, allowing the audio engine to do its job while each pattern calculates in async. As well as leaving this declarative programming.
ok, what an unlikely thing that you would read trough that, haven't "marketed" it at all.
not unlikely at all! I went and searched for it explicitly based off this conversation. Like I said, I was curious