summaryrefslogtreecommitdiff
path: root/src/unheard/time_object.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/unheard/time_object.clj')
-rw-r--r--src/unheard/time_object.clj22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/unheard/time_object.clj b/src/unheard/time_object.clj
index d2e888f..eea950b 100644
--- a/src/unheard/time_object.clj
+++ b/src/unheard/time_object.clj
@@ -19,6 +19,7 @@
;; BUG c9be408
(defn phrase
+ ;; TODO: Description
[& children]
(fn [start]
{:start start,
@@ -27,19 +28,20 @@
(update time-object :start (partial + start)))}))
(comment
- (def a (phrase (lift (time-object 0 4 :x))))
+ (def a (phrase (lift (time-object 0 4 :x)) (lift (time-object 0 4 :a))))
(def b
(phrase (a 0)
(a 1)
- (lift (time-object 10 2 :x))
+ (lift (time-object 10 2 :x) (time-object 10 2 :b))
(lift (time-object 0 2 :y))))
(def c (phrase (b 0) (b 3)))
(c 0))
(defn timeline
"Primary timeline bookkeeping mehanism."
- [{:keys [time-objects]}]
- (let [m imap/empty]
+ [phrase]
+ (let [{:keys [time-objects]} (phrase 0)
+ m imap/empty]
(if (seq? time-objects)
(loop [time-objects time-objects
m m]
@@ -50,18 +52,20 @@
m)))
(comment
- (def t (timeline (a 0)))
- (def t (timeline (c 0)))
- (get t 2))
+ (def t (timeline a))
+ (def t (timeline c))
+ (get t 1))
(defn point-query
"Query a timeline. Returns a flow of time objects."
[timeline >at]
- (m/ap (let [at (m/?< >at)] (get timeline at))))
+ (m/stream (m/ap (let [at (m/?< >at)] (get timeline at)))))
+
(comment
(def at (atom 0))
(def >at (m/watch at))
(def cancel ((m/reduce prn nil (point-query t >at)) prn prn))
- (reset! at 0)
+ (reset! at 1)
+ (reset! at 14)
(cancel))