-
-
Save dustingetz/8b099c2222a4560eb8965e88747e12fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns wip.missionary-clock | |
(:require [missionary.core :as m] | |
[hyperfiddle.rcf :refer [tests ! % with]])) | |
(hyperfiddle.rcf/enable!) | |
(defn clock [] | |
(->> (m/ap (loop [] (m/amb (m/? (m/sleep 1 1)) (recur)))) | |
(m/reductions + 0) ; logical clock | |
#_(m/reductions {} ::tick) ; physical clock | |
#_(m/relieve {}) ; heater, running clock at max speed, no laziness | |
)) | |
(tests | |
(def >clock (clock)) | |
(def !it (>clock (fn [] (! ::notify)) | |
(fn [] (! ::terminate)))) | |
% := ::notify | |
@!it := 0 | |
% := ::notify | |
@!it := 1 | |
% := ::notify | |
(!it)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment