This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-12
Channels
- # adventofcode (1)
- # announcements (6)
- # babashka (28)
- # beginners (75)
- # calva (8)
- # clj-commons (4)
- # clojure (39)
- # clojure-austin (5)
- # clojure-europe (7)
- # clojurescript (14)
- # clr (3)
- # datalevin (2)
- # fulcro (7)
- # funcool (1)
- # graphql (4)
- # helix (3)
- # hyperfiddle (5)
- # joyride (15)
- # malli (1)
- # missionary (16)
- # practicalli (1)
- # releases (1)
- # reveal (2)
- # tools-deps (14)
- # vim (9)
what’s the idiomatic approach to running a continuous missionary flow in the background? e.g.
(def rand-flow
(m/ap
(loop []
(m/amb
(rand)
(do (m/? (m/sleep 6e3)) (m/amb))
(recur)))))
I ran this blocking in the REPL like
(m/? (m/reduce (fn [_ v]
(println v))
nil
rand-flow))
but how can I run this in my program without blocking? given the underlying fiber impl it seems unusual to put the process into a java.lang.Thread
https://github.com/leonoel/task#task-1
(def cancel (my-task #(prn :ok %) #(prn :err %)))
🙏 2
Depends on the use case, maybe it could be done differently, but there's certainly nothing wrong running it as a task
finite vs infinite is orthogonal to task vs flow.
finite task : (m/sp 42)
infinite task : m/never
finite flow : (m/seed [:a :b :c])
infinite flow : (m/watch !x)
👍 4
Conceptually, yes. but the process can still terminate.
Trivial example : (m/cp 42)
the state is indefinitely the same, but the process terminates immediately