Fork me on GitHub
#missionary
<
2023-08-27
>
pez10:08:49

👋

👋 4
pez11:08:17

I’m doing the https://github.com/leonoel/missionary/wiki/Basic-Walkthrough:-Tasks-&amp;-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.

leonoel11:08:21

that's the right call, thanks

pez11:08:41

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…

pez11:08:25

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).

pez11:08:02

Oh, and I also read https://github.com/leonoel/task. Again, will probably have to reread several times. Super great stuff.

pez11:08:18

Telling you this so that you can know where my feedback comes from. 😃

🙏 2
leonoel11:08:44

Your feedback is very welcome. The documentation is being reworked, I will communicate more about it soon

pez11:08:03

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?

leonoel11:08:57

yes, it refers to the symbol in the arglist meta. How do you read the docstring (source file / cljdoc / IDE) ?

pez11:08:05

IDE and source file.

pez11:08:12

Rereading the docstrings, I think the rf mentions are probably fine. At least I don’t see how it could be made clearer. 😃

Dustin Getz12:08:26

my signals/streams blog post is also important , i know you’ve already gone through it

pez15:08:37

I’ll have to go through it again a few times. 😃

pez15:08:31

I think I would benefit from more tutorial stuff, with things I can try at the repl.

pez15:08:21

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?

pez15:08:12

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.

leonoel18:08:14

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

🙏 1
👍 1
pez16:08:38

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.

Dustin Getz18:08:37

@U0ETXRFEW check the terminal the REPL is attached to:

pez18:08:30

Oh, wow. That’s embarrassing. 😀

Dustin Getz18:08:30

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

pez19:08:03

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).

Dustin Getz19:08:27

My statement needs to be double checked