This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-27
Channels
- # announcements (1)
- # beginners (29)
- # biff (14)
- # calva (13)
- # cider (8)
- # clj-kondo (6)
- # cljdoc (8)
- # clojure (8)
- # clojure-europe (2)
- # clojurescript (2)
- # conjure (2)
- # emacs (45)
- # holy-lambda (8)
- # honeysql (5)
- # integrant (2)
- # jobs (2)
- # kaocha (1)
- # life (1)
- # malli (3)
- # missionary (30)
- # nrepl (3)
- # off-topic (26)
- # scittle (6)
- # sql (6)
- # tools-deps (8)
- # xtdb (3)
I’m doing the https://github.com/leonoel/missionary/wiki/Basic-Walkthrough:-Tasks-&-Flows. It’s using the deprecated m/?=
. The docs says it is an alias for m/?>
called with a parallelization cap of ##Inf
. I replaced the example with that instead. FYI, in case it was the wrong call.
Generally I got a bit confused at the first examples, which only returns functions in the REPL. Maybe that’s the point? I think I’d like for the walkthrough to tell me a tad more about the results from the examples…
Total noob here. Only have watched https://youtu.be/tV-DoiGdUIo?si=1eWnO56cH0kFR_3a and read the project README (which is great, even if I probably need to read it several more times as I hopefully collect more understanding).
Oh, and I also read https://github.com/leonoel/task. Again, will probably have to reread several times. Super great stuff.
Your feedback is very welcome. The documentation is being reworked, I will communicate more about it soon
I like the docstrings on the functions and macros. Though rf
is used as if I should know what it is. Is it a reducing function?
yes, it refers to the symbol in the arglist meta. How do you read the docstring (source file / cljdoc / IDE) ?
Rereading the docstrings, I think the rf
mentions are probably fine. At least I don’t see how it could be made clearer. 😃
@pez this doc was a breakthrough for me https://gist.github.com/dustingetz/08c87050df3a26874d41886777422e8e
my signals/streams blog post is also important , i know you’ve already gone through it
The flows example:
(let [begin (System/currentTimeMillis)
;; create a flow of values generated by asynchronous tasks
inputs (repeat 1000 (m/via m/cpu "hi")) ;; a task has no identity, it can be reused
values (m/ap
(let [flow (m/seed inputs) ;; create a flow of tasks to execute
task (m/?> ##Inf flow)] ;; from here, fork on every task in **parallel**
(m/? task))) ;; get a forked task value when available
;; drain the flow of values and count them
n (m/? ;; tasks are executed, and flow is consume here!
(m/reduce (fn [acc v]
(assert (= "hi" v))
(inc acc))
0 values))]
(println "Read" n "msgs in" (- (System/currentTimeMillis) begin) "ms"))
It seems to lock up when trying with 100K inputs. Is that to be expected?I also wonder about the comment that: >
;; a task has no identity, it can be reused
Seems I lack some basic understanding to get what it tells me.This comment points out that unlike a promise or a channel, a task is a stateless value, it is just a recipe describing how to run an effect. If you need to run the same effect multiple times, you do not have to reconstruct the recipe, you can reuse the same instance. Feel free to propose a better explanation
Now checking out the https://github.com/leonoel/missionary/blob/master/doc/tutorials/hello_task.md tutorial. -> 🧵
The example:
(def nap (m/sleep 1000))
(def slowmo-hello-world
(m/sp (println "Hello")
(m/? nap)
(println "World")
(m/? nap)
(println "!")))
(m/? slowmo-hello-world)
• With Clojure this prints Hello
and then returns nil
. I think it takes the naps.
• With ClojureScript it works as advertised.I reported it as an issue: https://github.com/leonoel/missionary/issues/91
@U0ETXRFEW check the terminal the REPL is attached to:
my intuition is that stdout is not rebound globally across all threads (just the repl thread) and therefore implementing the stdout redirect with alter-var-root would fix it, but i dont know which layer in the toolchain is responsible for that and maybe there are other factors in play making that approach challenging
I would expect this to be handled on the nrepl level, but I’m obviously wrong about that (obviously, because of your comment on the issue informing me that they have fixed it in CIDER).
My statement needs to be double checked
I’m double checking it here: https://clojurians.slack.com/archives/C17JYSA3H/p1693163125991679
Now tracking this here: https://github.com/BetterThanTomorrow/calva/issues/2300