missionary 2024-11-26

Was reading https://nextjournal.com/N-litened/missionary-for-dummies And was confused by one example. Is this not unnecessary to use m/sp and m/? to park each sleep? Doesn't m/join already park the sleeps implicitly?

(m/? ;; The outer m/? is here just to force the m/sp to actually run. This one blocks.
  (m/join vector
    ;; all five question marks below run "in parallel" on a single thread, they park their
    ;; parent tasks (generated by m/sp) instead of blocking our thread from doing anything
    (m/sp (m/? (m/sleep 1000 :how)))
    (m/sp (m/? (m/sleep 1000 :do)))
    (m/sp (m/? (m/sleep 1000 :you)))
    (m/sp (m/? (m/sleep 1000 :like)))
    (m/sp (m/? (m/sleep 1000 :this?)))))

Yep, you're right. This was an example of how it's possible to nest m/? inside m/sp, as opposed to a similar example right above it which does the same thing but without m/sp and m/? — I agree that I should expand the explanation to make it less confusing 🙏

Thanks for your guide, it's been really helpful

❤️ 1
➕ 1

indeed, (m/sp (m/? x)) is just x