Home

missionary.core/rdv

Usage

Description

A port constructor defining a synchronous rendez-vous. A rendez-vous is an unbuffered communication channel allowing messages to be transferred from a sender to a receiver when both ends are ready to do so. Sending and reception are asynchronous effects completing on transfer.

Examples

(require '[missionary.core :as m])

(def r (m/rdv))

(def main
  (m/join (constantly nil)
    (m/sp
      (m/? (r :foo))
      (m/? (r :bar))
      (m/? (r :baz)))
    (m/sp (prn :> (m/? r) (m/? r) (m/? r)))))

(def ps (main #(prn :success %) #(prn :failure %)))
:> :foo :bar :baz
:success nil

Synchronicity