summaryrefslogtreecommitdiff
path: root/src/unheard/theory.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/unheard/theory.clj')
-rw-r--r--src/unheard/theory.clj17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/unheard/theory.clj b/src/unheard/theory.clj
index e9e4ad5..6ceff3e 100644
--- a/src/unheard/theory.clj
+++ b/src/unheard/theory.clj
@@ -7,8 +7,12 @@
[>clock start duration >value]
(time-object start
duration
- (m/cp (let [[c v] (m/?< (m/latest vector >clock >value))]
- (if (<= start c (dec (+ start duration))) #{v} #{})))))
+ [(gensym)
+ (m/cp (let [[c v] (m/?< (m/latest vector >clock >value))]
+ (if (<= start c (dec (+ start duration))) #{v} #{})))]))
+
+;; Reducing function that returns diffs :add v :remove v
+;; Reducing function that unfolds to values
(comment
(require '[unheard.time-object :refer [lift phrase timeline point-query]])
@@ -20,6 +24,15 @@
(def song (phrase (lift n)))
(def t (timeline (song 0)))
(def r (point-query t >c))
+ (def r
+ (m/ap (try (m/?<
+ ;; TODO: Simplify
+ (apply m/latest
+ vector
+ (point-query t >c)
+ (vals (m/?< (m/eduction (map #(into {} %))
+ (point-query t >c))))))
+ (catch missionary.Cancelled _ (m/amb)))))
(def cancel ((m/reduce prn nil r) prn prn))
(cancel)
(swap! c dec)