Fork me on GitHub

can i somehow cancel the task from outside?


something like clearTimeout ?


this is not public, what are you trying to do ?

meta-meta05:12:14;cid=CL85MBPEF Hi @leonoel and everyone else! I'm a React dev for 6 or 7 years and I develop VR music software in my free time. I'm looking to implement something like this: I'm working with Arcadia which is a clojure-clr integration for the Unity game engine. I need something that manages DAG data-flow like a spreadsheet and some way to observe updates to each cell so I can reflect changes in the UI. Each cell would be represented by some interactive game object. The example you posted about signals in a reactor makes sense except instead of rendering DOM, I'd be creating cells (adding signals?) on the fly and I'd want to update just that cell's corresponding game object when its value changes. Is there some way to subscribe to changes in an individual signal?


Thinking about this some more, the single subscription to the whole graph would work. Each cell's game object can just look at its value in the latest state and update itself if the value has changed. I don't need to think of the change as an event like I was inclined to because game objects have an update hook running at 60fps.


What I'm missing now is, how do you add/remove signals within a reactor dynamically?


To add a signal, just call signal!. It can be done dynamically but it must be in reaction to an event processed by the reactor. To remove a signal, you can call it as a function with no argument, it will cancel the underlying process

👍 1

That's an interesting use case, is CLR support required here ?


I was initially thinking CLR is required but after some thought, it wouldn't add much complexity to run Missionary on a CLJ server and send update messages to the VR client. In my case it might even be preferable since all the code I'm trying to wrap is already in a CLJ project with OSC and MIDI communication setup.

Dustin Getz14:12:20

Hi Paul. signals can contain signals (i.e. higher order), and there is an operator to flatten nested signals, you can use m/latest to get a value out of a signal that happens to be a signal and then use it accordingly

🙏 1

why this work

(defn somefn [[x d]]
  (println :x x :d d)
  (mi/sleep d x))

((mi/reduce conj (mi/ap (mi/? (somefn (mi/?> (mi/seed [[:a 1000] [:b 1000] [:c 1000]])))))) (constantly nil) prn)
but this not?
(defn someotherfn [[x d]]
  (println :x x :d d)
  (mi/? (mi/sleep d x)))

((mi/reduce conj (mi/ap (someotherfn (mi/?> (mi/seed [[:a 1000] [:b 1000] [:c 1000]]))))) (constantly nil) prn)

Ben Sless11:12:50

Probably ap changes the semantics of ?


but for example in core.async the use of go also allows you to use <! inside called functions etc.


and I have no idea how to get around it

Ben Sless11:12:57

not so, you have to use <! inside a go block. Which means you need to return the equivalent of a go block from the function, i.e. return a ap from it


indeed, as you can see I'm remembering wrong 😜

😅 2

? is undefined outside of sp and ap for the same reasons <! and >! are undefined outside of go


? is a delimiter for syntax rewriting, which is a compile-time transformation


in the general case, we can't rewrite syntax if we assume parking can happen in arbitrarily nested frames