initial commit

This commit is contained in:
2026-06-25 21:30:32 +00:00
commit 328faf6251
220 changed files with 162103 additions and 0 deletions
+886
View File
@@ -0,0 +1,886 @@
(ns cljs.core.async
(:refer-clojure :exclude [reduce into merge map take partition partition-by])
(:require [cljs.core.async.impl.protocols :as impl]
[cljs.core.async.impl.channels :as channels]
[cljs.core.async.impl.buffers :as buffers]
[cljs.core.async.impl.timers :as timers]
[cljs.core.async.impl.dispatch :as dispatch]
[cljs.core.async.impl.ioc-helpers :as helpers])
(:require-macros [cljs.core.async.impl.ioc-macros :as ioc]
[cljs.core.async.macros :refer [go go-loop]]))
(defn- fn-handler [f]
(reify
impl/Handler
(active? [_] true)
(commit [_] f)))
(defn buffer
"Returns a fixed buffer of size n. When full, puts will block/park."
[n]
(buffers/fixed-buffer n))
(defn dropping-buffer
"Returns a buffer of size n. When full, puts will complete but
val will be dropped (no transfer)."
[n]
(buffers/dropping-buffer n))
(defn sliding-buffer
"Returns a buffer of size n. When full, puts will complete, and be
buffered, but oldest elements in buffer will be dropped (not
transferred)."
[n]
(buffers/sliding-buffer n))
(defn unblocking-buffer?
"Returns true if a channel created with buff will never block. That is to say,
puts into this buffer will never cause the buffer to be full. "
[buff]
(satisfies? impl/UnblockingBuffer buff))
(defn chan
"Creates a channel with an optional buffer, an optional transducer (like (map f),
(filter p) etc or a composition thereof), and an optional exception handler.
If buf-or-n is a number, will create and use a fixed buffer of that size. If a
transducer is supplied a buffer must be specified. ex-handler must be a
fn of one argument - if an exception occurs during transformation it will be called
with the thrown value as an argument, and any non-nil return value will be placed
in the channel."
([] (chan nil))
([buf-or-n] (chan buf-or-n nil nil))
([buf-or-n xform] (chan buf-or-n xform nil))
([buf-or-n xform ex-handler]
(let [buf-or-n (if (= buf-or-n 0)
nil
buf-or-n)]
(when xform (assert buf-or-n "buffer must be supplied when transducer is"))
(channels/chan (if (number? buf-or-n)
(buffer buf-or-n)
buf-or-n)
xform
ex-handler))))
(defn timeout
"Returns a channel that will close after msecs"
[msecs]
(timers/timeout msecs))
(defn <!
"takes a val from port. Must be called inside a (go ...) block. Will
return nil if closed. Will park if nothing is available.
Returns true unless port is already closed"
[port]
(throw (js/Error. "<! used not in (go ...) block")))
(defn take!
"Asynchronously takes a val from port, passing to fn1. Will pass nil
if closed. If on-caller? (default true) is true, and value is
immediately available, will call fn1 on calling thread.
Returns nil."
([port fn1] (take! port fn1 true))
([port fn1 on-caller?]
(let [ret (impl/take! port (fn-handler fn1))]
(when ret
(let [val @ret]
(if on-caller?
(fn1 val)
(dispatch/run #(fn1 val)))))
nil)))
(defn- nop [_])
(def ^:private fhnop (fn-handler nop))
(defn >!
"puts a val into port. nil values are not allowed. Must be called
inside a (go ...) block. Will park if no buffer space is available.
Returns true unless port is already closed."
[port val]
(throw (js/Error. ">! used not in (go ...) block")))
(defn put!
"Asynchronously puts a val into port, calling fn0 (if supplied) when
complete. nil values are not allowed. Will throw if closed. If
on-caller? (default true) is true, and the put is immediately
accepted, will call fn0 on calling thread. Returns nil."
([port val]
(if-let [ret (impl/put! port val fhnop)]
@ret
true))
([port val fn1] (put! port val fn1 true))
([port val fn1 on-caller?]
(if-let [retb (impl/put! port val (fn-handler fn1))]
(let [ret @retb]
(if on-caller?
(fn1 ret)
(dispatch/run #(fn1 ret)))
ret)
true)))
(defn close!
([port]
(impl/close! port)))
(defn- random-array
[n]
(let [a (make-array n)]
(dotimes [x n]
(aset a x 0))
(loop [i 1]
(if (= i n)
a
(do
(let [j (rand-int i)]
(aset a i (aget a j))
(aset a j i)
(recur (inc i))))))))
(defn- alt-flag []
(let [flag (atom true)]
(reify
impl/Handler
(active? [_] @flag)
(commit [_]
(reset! flag nil)
true))))
(defn- alt-handler [flag cb]
(reify
impl/Handler
(active? [_] (impl/active? flag))
(commit [_]
(impl/commit flag)
cb)))
(defn do-alts
"returns derefable [val port] if immediate, nil if enqueued"
[fret ports opts]
(let [flag (alt-flag)
n (count ports)
idxs (random-array n)
priority (:priority opts)
ret
(loop [i 0]
(when (< i n)
(let [idx (if priority i (aget idxs i))
port (nth ports idx)
wport (when (vector? port) (port 0))
vbox (if wport
(let [val (port 1)]
(impl/put! wport val (alt-handler flag #(fret [% wport]))))
(impl/take! port (alt-handler flag #(fret [% port]))))]
(if vbox
(channels/box [@vbox (or wport port)])
(recur (inc i))))))]
(or
ret
(when (contains? opts :default)
(when-let [got (and (impl/active? flag) (impl/commit flag))]
(channels/box [(:default opts) :default]))))))
(defn alts!
"Completes at most one of several channel operations. Must be called
inside a (go ...) block. ports is a vector of channel endpoints,
which can be either a channel to take from or a vector of
[channel-to-put-to val-to-put], in any combination. Takes will be
made as if by <!, and puts will be made as if by >!. Unless
the :priority option is true, if more than one port operation is
ready a non-deterministic choice will be made. If no operation is
ready and a :default value is supplied, [default-val :default] will
be returned, otherwise alts! will park until the first operation to
become ready completes. Returns [val port] of the completed
operation, where val is the value taken for takes, and a
boolean (true unless already closed, as per put!) for puts.
opts are passed as :key val ... Supported options:
:default val - the value to use if none of the operations are immediately ready
:priority true - (default nil) when true, the operations will be tried in order.
Note: there is no guarantee that the port exps or val exprs will be
used, nor in what order should they be, so they should not be
depended upon for side effects."
[ports & {:as opts}]
(throw (js/Error. "alts! used not in (go ...) block")))
;;;;;;; channel ops
(defn pipe
"Takes elements from the from channel and supplies them to the to
channel. By default, the to channel will be closed when the from
channel closes, but can be determined by the close? parameter. Will
stop consuming the from channel if the to channel closes"
([from to] (pipe from to true))
([from to close?]
(go-loop []
(let [v (<! from)]
(if (nil? v)
(when close? (close! to))
(when (>! to v)
(recur)))))
to))
(defn- pipeline*
([n to xf from close? ex-handler type]
(assert (pos? n))
(let [jobs (chan n)
results (chan n)
process (fn [[v p :as job]]
(if (nil? job)
(do (close! results) nil)
(let [res (chan 1 xf ex-handler)]
(go
(>! res v)
(close! res))
(put! p res)
true)))
async (fn [[v p :as job]]
(if (nil? job)
(do (close! results) nil)
(let [res (chan 1)]
(xf v res)
(put! p res)
true)))]
(dotimes [_ n]
(case type
:compute (go-loop []
(let [job (<! jobs)]
(when (process job)
(recur))))
:async (go-loop []
(let [job (<! jobs)]
(when (async job)
(recur))))))
(go-loop []
(let [v (<! from)]
(if (nil? v)
(close! jobs)
(let [p (chan 1)]
(>! jobs [v p])
(>! results p)
(recur)))))
(go-loop []
(let [p (<! results)]
(if (nil? p)
(when close? (close! to))
(let [res (<! p)]
(loop []
(let [v (<! res)]
(when (and (not (nil? v)) (>! to v))
(recur))))
(recur))))))))
(defn pipeline-async
"Takes elements from the from channel and supplies them to the to
channel, subject to the async function af, with parallelism n. af
must be a function of two arguments, the first an input value and
the second a channel on which to place the result(s). af must close!
the channel before returning. The presumption is that af will
return immediately, having launched some asynchronous operation
whose completion/callback will manipulate the result channel. Outputs
will be returned in order relative to the inputs. By default, the to
channel will be closed when the from channel closes, but can be
determined by the close? parameter. Will stop consuming the from
channel if the to channel closes."
([n to af from] (pipeline-async n to af from true))
([n to af from close?] (pipeline* n to af from close? nil :async)))
(defn pipeline
"Takes elements from the from channel and supplies them to the to
channel, subject to the transducer xf, with parallelism n. Because
it is parallel, the transducer will be applied independently to each
element, not across elements, and may produce zero or more outputs
per input. Outputs will be returned in order relative to the
inputs. By default, the to channel will be closed when the from
channel closes, but can be determined by the close? parameter. Will
stop consuming the from channel if the to channel closes.
Note this is supplied for API compatibility with the Clojure version.
Values of N > 1 will not result in actual concurrency in a
single-threaded runtime."
([n to xf from] (pipeline n to xf from true))
([n to xf from close?] (pipeline n to xf from close? nil))
([n to xf from close? ex-handler] (pipeline* n to xf from close? ex-handler :compute)))
(defn split
"Takes a predicate and a source channel and returns a vector of two
channels, the first of which will contain the values for which the
predicate returned true, the second those for which it returned
false.
The out channels will be unbuffered by default, or two buf-or-ns can
be supplied. The channels will close after the source channel has
closed."
([p ch] (split p ch nil nil))
([p ch t-buf-or-n f-buf-or-n]
(let [tc (chan t-buf-or-n)
fc (chan f-buf-or-n)]
(go-loop []
(let [v (<! ch)]
(if (nil? v)
(do (close! tc) (close! fc))
(when (>! (if (p v) tc fc) v)
(recur)))))
[tc fc])))
(defn reduce
"f should be a function of 2 arguments. Returns a channel containing
the single result of applying f to init and the first item from the
channel, then applying f to that result and the 2nd item, etc. If
the channel closes without yielding items, returns init and f is not
called. ch must close before reduce produces a result."
[f init ch]
(go-loop [ret init]
(let [v (<! ch)]
(if (nil? v)
ret
(recur (f ret v))))))
(defn onto-chan
"Puts the contents of coll into the supplied channel.
By default the channel will be closed after the items are copied,
but can be determined by the close? parameter.
Returns a channel which will close after the items are copied."
([ch coll] (onto-chan ch coll true))
([ch coll close?]
(go-loop [vs (seq coll)]
(if (and vs (>! ch (first vs)))
(recur (next vs))
(when close?
(close! ch))))))
(defn to-chan
"Creates and returns a channel which contains the contents of coll,
closing when exhausted."
[coll]
(let [ch (chan (bounded-count 100 coll))]
(onto-chan ch coll)
ch))
(defprotocol Mux
(muxch* [_]))
(defprotocol Mult
(tap* [m ch close?])
(untap* [m ch])
(untap-all* [m]))
(defn mult
"Creates and returns a mult(iple) of the supplied channel. Channels
containing copies of the channel can be created with 'tap', and
detached with 'untap'.
Each item is distributed to all taps in parallel and synchronously,
i.e. each tap must accept before the next item is distributed. Use
buffering/windowing to prevent slow taps from holding up the mult.
Items received when there are no taps get dropped.
If a tap puts to a closed channel, it will be removed from the mult."
[ch]
(let [cs (atom {}) ;;ch->close?
m (reify
Mux
(muxch* [_] ch)
Mult
(tap* [_ ch close?] (swap! cs assoc ch close?) nil)
(untap* [_ ch] (swap! cs dissoc ch) nil)
(untap-all* [_] (reset! cs {}) nil))
dchan (chan 1)
dctr (atom nil)
done (fn [_] (when (zero? (swap! dctr dec))
(put! dchan true)))]
(go-loop []
(let [val (<! ch)]
(if (nil? val)
(doseq [[c close?] @cs]
(when close? (close! c)))
(let [chs (keys @cs)]
(reset! dctr (count chs))
(doseq [c chs]
(when-not (put! c val done)
(done nil)
(untap* m c)))
;;wait for all
(when (seq chs)
(<! dchan))
(recur)))))
m))
(defn tap
"Copies the mult source onto the supplied channel.
By default the channel will be closed when the source closes,
but can be determined by the close? parameter."
([mult ch] (tap mult ch true))
([mult ch close?] (tap* mult ch close?) ch))
(defn untap
"Disconnects a target channel from a mult"
[mult ch]
(untap* mult ch))
(defn untap-all
"Disconnects all target channels from a mult"
[mult] (untap-all* mult))
(defprotocol Mix
(admix* [m ch])
(unmix* [m ch])
(unmix-all* [m])
(toggle* [m state-map])
(solo-mode* [m mode]))
(defn ioc-alts! [state cont-block ports & {:as opts}]
(ioc/aset-all! state helpers/STATE-IDX cont-block)
(when-let [cb (cljs.core.async/do-alts
(fn [val]
(ioc/aset-all! state helpers/VALUE-IDX val)
(helpers/run-state-machine-wrapped state))
ports
opts)]
(ioc/aset-all! state helpers/VALUE-IDX @cb)
:recur))
(defn mix
"Creates and returns a mix of one or more input channels which will
be put on the supplied out channel. Input sources can be added to
the mix with 'admix', and removed with 'unmix'. A mix supports
soloing, muting and pausing multiple inputs atomically using
'toggle', and can solo using either muting or pausing as determined
by 'solo-mode'.
Each channel can have zero or more boolean modes set via 'toggle':
:solo - when true, only this (ond other soloed) channel(s) will appear
in the mix output channel. :mute and :pause states of soloed
channels are ignored. If solo-mode is :mute, non-soloed
channels are muted, if :pause, non-soloed channels are
paused.
:mute - muted channels will have their contents consumed but not included in the mix
:pause - paused channels will not have their contents consumed (and thus also not included in the mix)
"
[out]
(let [cs (atom {}) ;;ch->attrs-map
solo-modes #{:mute :pause}
attrs (conj solo-modes :solo)
solo-mode (atom :mute)
change (chan)
changed #(put! change true)
pick (fn [attr chs]
(reduce-kv
(fn [ret c v]
(if (attr v)
(conj ret c)
ret))
#{} chs))
calc-state (fn []
(let [chs @cs
mode @solo-mode
solos (pick :solo chs)
pauses (pick :pause chs)]
{:solos solos
:mutes (pick :mute chs)
:reads (conj
(if (and (= mode :pause) (not (empty? solos)))
(vec solos)
(vec (remove pauses (keys chs))))
change)}))
m (reify
Mux
(muxch* [_] out)
Mix
(admix* [_ ch] (swap! cs assoc ch {}) (changed))
(unmix* [_ ch] (swap! cs dissoc ch) (changed))
(unmix-all* [_] (reset! cs {}) (changed))
(toggle* [_ state-map] (swap! cs (partial merge-with cljs.core/merge) state-map) (changed))
(solo-mode* [_ mode]
(assert (solo-modes mode) (str "mode must be one of: " solo-modes))
(reset! solo-mode mode)
(changed)))]
(go-loop [{:keys [solos mutes reads] :as state} (calc-state)]
(let [[v c] (alts! reads)]
(if (or (nil? v) (= c change))
(do (when (nil? v)
(swap! cs dissoc c))
(recur (calc-state)))
(if (or (solos c)
(and (empty? solos) (not (mutes c))))
(when (>! out v)
(recur state))
(recur state)))))
m))
(defn admix
"Adds ch as an input to the mix"
[mix ch]
(admix* mix ch))
(defn unmix
"Removes ch as an input to the mix"
[mix ch]
(unmix* mix ch))
(defn unmix-all
"removes all inputs from the mix"
[mix]
(unmix-all* mix))
(defn toggle
"Atomically sets the state(s) of one or more channels in a mix. The
state map is a map of channels -> channel-state-map. A
channel-state-map is a map of attrs -> boolean, where attr is one or
more of :mute, :pause or :solo. Any states supplied are merged with
the current state.
Note that channels can be added to a mix via toggle, which can be
used to add channels in a particular (e.g. paused) state."
[mix state-map]
(toggle* mix state-map))
(defn solo-mode
"Sets the solo mode of the mix. mode must be one of :mute or :pause"
[mix mode]
(solo-mode* mix mode))
(defprotocol Pub
(sub* [p v ch close?])
(unsub* [p v ch])
(unsub-all* [p] [p v]))
(defn pub
"Creates and returns a pub(lication) of the supplied channel,
partitioned into topics by the topic-fn. topic-fn will be applied to
each value on the channel and the result will determine the 'topic'
on which that value will be put. Channels can be subscribed to
receive copies of topics using 'sub', and unsubscribed using
'unsub'. Each topic will be handled by an internal mult on a
dedicated channel. By default these internal channels are
unbuffered, but a buf-fn can be supplied which, given a topic,
creates a buffer with desired properties.
Each item is distributed to all subs in parallel and synchronously,
i.e. each sub must accept before the next item is distributed. Use
buffering/windowing to prevent slow subs from holding up the pub.
Items received when there are no matching subs get dropped.
Note that if buf-fns are used then each topic is handled
asynchronously, i.e. if a channel is subscribed to more than one
topic it should not expect them to be interleaved identically with
the source."
([ch topic-fn] (pub ch topic-fn (constantly nil)))
([ch topic-fn buf-fn]
(let [mults (atom {}) ;;topic->mult
ensure-mult (fn [topic]
(or (get @mults topic)
(get (swap! mults
#(if (% topic) % (assoc % topic (mult (chan (buf-fn topic))))))
topic)))
p (reify
Mux
(muxch* [_] ch)
Pub
(sub* [p topic ch close?]
(let [m (ensure-mult topic)]
(tap m ch close?)))
(unsub* [p topic ch]
(when-let [m (get @mults topic)]
(untap m ch)))
(unsub-all* [_] (reset! mults {}))
(unsub-all* [_ topic] (swap! mults dissoc topic)))]
(go-loop []
(let [val (<! ch)]
(if (nil? val)
(doseq [m (vals @mults)]
(close! (muxch* m)))
(let [topic (topic-fn val)
m (get @mults topic)]
(when m
(when-not (>! (muxch* m) val)
(swap! mults dissoc topic)))
(recur)))))
p)))
(defn sub
"Subscribes a channel to a topic of a pub.
By default the channel will be closed when the source closes,
but can be determined by the close? parameter."
([p topic ch] (sub p topic ch true))
([p topic ch close?] (sub* p topic ch close?)))
(defn unsub
"Unsubscribes a channel from a topic of a pub"
[p topic ch]
(unsub* p topic ch))
(defn unsub-all
"Unsubscribes all channels from a pub, or a topic of a pub"
([p] (unsub-all* p))
([p topic] (unsub-all* p topic)))
;;;;
(defn map
"Takes a function and a collection of source channels, and returns a
channel which contains the values produced by applying f to the set
of first items taken from each source channel, followed by applying
f to the set of second items from each channel, until any one of the
channels is closed, at which point the output channel will be
closed. The returned channel will be unbuffered by default, or a
buf-or-n can be supplied"
([f chs] (map f chs nil))
([f chs buf-or-n]
(let [chs (vec chs)
out (chan buf-or-n)
cnt (count chs)
rets (object-array cnt)
dchan (chan 1)
dctr (atom nil)
done (mapv (fn [i]
(fn [ret]
(aset rets i ret)
(when (zero? (swap! dctr dec))
(put! dchan (.slice rets 0)))))
(range cnt))]
(go-loop []
(reset! dctr cnt)
(dotimes [i cnt]
(try
(take! (chs i) (done i))
(catch js/Object e
(swap! dctr dec))))
(let [rets (<! dchan)]
(if (some nil? rets)
(close! out)
(do (>! out (apply f rets))
(recur)))))
out)))
(defn merge
"Takes a collection of source channels and returns a channel which
contains all values taken from them. The returned channel will be
unbuffered by default, or a buf-or-n can be supplied. The channel
will close after all the source channels have closed."
([chs] (merge chs nil))
([chs buf-or-n]
(let [out (chan buf-or-n)]
(go-loop [cs (vec chs)]
(if (pos? (count cs))
(let [[v c] (alts! cs)]
(if (nil? v)
(recur (filterv #(not= c %) cs))
(do (>! out v)
(recur cs))))
(close! out)))
out)))
(defn into
"Returns a channel containing the single (collection) result of the
items taken from the channel conjoined to the supplied
collection. ch must close before into produces a result."
[coll ch]
(reduce conj coll ch))
(defn take
"Returns a channel that will return, at most, n items from ch. After n items
have been returned, or ch has been closed, the return chanel will close.
The output channel is unbuffered by default, unless buf-or-n is given."
([n ch]
(take n ch nil))
([n ch buf-or-n]
(let [out (chan buf-or-n)]
(go (loop [x 0]
(when (< x n)
(let [v (<! ch)]
(when (not (nil? v))
(>! out v)
(recur (inc x))))))
(close! out))
out)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; deprecated - do not use ;;;;;;;;;;;;;;;;;;;;;;;;;
(defn map<
"Deprecated - this function will be removed. Use transducer instead"
[f ch]
(reify
impl/Channel
(close! [_] (impl/close! ch))
(closed? [_] (impl/closed? ch))
impl/ReadPort
(take! [_ fn1]
(let [ret
(impl/take! ch
(reify
impl/Handler
(active? [_] (impl/active? fn1))
#_(lock-id [_] (impl/lock-id fn1))
(commit [_]
(let [f1 (impl/commit fn1)]
#(f1 (if (nil? %) nil (f %)))))))]
(if (and ret (not (nil? @ret)))
(channels/box (f @ret))
ret)))
impl/WritePort
(put! [_ val fn1] (impl/put! ch val fn1))))
(defn map>
"Deprecated - this function will be removed. Use transducer instead"
[f ch]
(reify
impl/Channel
(close! [_] (impl/close! ch))
impl/ReadPort
(take! [_ fn1] (impl/take! ch fn1))
impl/WritePort
(put! [_ val fn1]
(impl/put! ch (f val) fn1))))
(defn filter>
"Deprecated - this function will be removed. Use transducer instead"
[p ch]
(reify
impl/Channel
(close! [_] (impl/close! ch))
(closed? [_] (impl/closed? ch))
impl/ReadPort
(take! [_ fn1] (impl/take! ch fn1))
impl/WritePort
(put! [_ val fn1]
(if (p val)
(impl/put! ch val fn1)
(channels/box (not (impl/closed? ch)))))))
(defn remove>
"Deprecated - this function will be removed. Use transducer instead"
[p ch]
(filter> (complement p) ch))
(defn filter<
"Deprecated - this function will be removed. Use transducer instead"
([p ch] (filter< p ch nil))
([p ch buf-or-n]
(let [out (chan buf-or-n)]
(go-loop []
(let [val (<! ch)]
(if (nil? val)
(close! out)
(do (when (p val)
(>! out val))
(recur)))))
out)))
(defn remove<
"Deprecated - this function will be removed. Use transducer instead"
([p ch] (remove< p ch nil))
([p ch buf-or-n] (filter< (complement p) ch buf-or-n)))
(defn- mapcat* [f in out]
(go-loop []
(let [val (<! in)]
(if (nil? val)
(close! out)
(do (doseq [v (f val)]
(>! out v))
(when-not (impl/closed? out)
(recur)))))))
(defn mapcat<
"Deprecated - this function will be removed. Use transducer instead"
([f in] (mapcat< f in nil))
([f in buf-or-n]
(let [out (chan buf-or-n)]
(mapcat* f in out)
out)))
(defn mapcat>
"Deprecated - this function will be removed. Use transducer instead"
([f out] (mapcat> f out nil))
([f out buf-or-n]
(let [in (chan buf-or-n)]
(mapcat* f in out)
in)))
(defn unique
"Deprecated - this function will be removed. Use transducer instead"
([ch]
(unique ch nil))
([ch buf-or-n]
(let [out (chan buf-or-n)]
(go (loop [last nil]
(let [v (<! ch)]
(when (not (nil? v))
(if (= v last)
(recur last)
(do (>! out v)
(recur v))))))
(close! out))
out)))
(defn partition
"Deprecated - this function will be removed. Use transducer instead"
([n ch]
(partition n ch nil))
([n ch buf-or-n]
(let [out (chan buf-or-n)]
(go (loop [arr (make-array n)
idx 0]
(let [v (<! ch)]
(if (not (nil? v))
(do (aset ^objects arr idx v)
(let [new-idx (inc idx)]
(if (< new-idx n)
(recur arr new-idx)
(do (>! out (vec arr))
(recur (make-array n) 0)))))
(do (when (> idx 0)
(>! out (vec arr)))
(close! out))))))
out)))
(defn partition-by
"Deprecated - this function will be removed. Use transducer instead"
([f ch]
(partition-by f ch nil))
([f ch buf-or-n]
(let [out (chan buf-or-n)]
(go (loop [lst (make-array 0)
last ::nothing]
(let [v (<! ch)]
(if (not (nil? v))
(let [new-itm (f v)]
(if (or (= new-itm last)
(keyword-identical? last ::nothing))
(do (.push lst v)
(recur lst new-itm))
(do (>! out (vec lst))
(let [new-lst (make-array 0)]
(.push new-lst v)
(recur new-lst new-itm)))))
(do (when (> (alength lst) 0)
(>! out (vec lst)))
(close! out))))))
out)))
+8486
View File
File diff suppressed because it is too large Load Diff
+131
View File
@@ -0,0 +1,131 @@
;; Copyright (c) Rich Hickey and contributors. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.core.async.impl.buffers
(:require [cljs.core.async.impl.protocols :as impl]))
;; -----------------------------------------------------------------------------
;; DO NOT USE, this is internal buffer representation
(defn acopy [src src-start dest dest-start len]
(loop [cnt 0]
(when (< cnt len)
(aset dest
(+ dest-start cnt)
(aget src (+ src-start cnt)))
(recur (inc cnt)))))
(deftype RingBuffer [^:mutable head ^:mutable tail ^:mutable length ^:mutable arr]
Object
(pop [_]
(when-not (zero? length)
(let [x (aget arr tail)]
(aset arr tail nil)
(set! tail (js-mod (inc tail) (alength arr)))
(set! length (dec length))
x)))
(unshift [_ x]
(aset arr head x)
(set! head (js-mod (inc head) (alength arr)))
(set! length (inc length))
nil)
(unbounded-unshift [this x]
(if (== (inc length) (alength arr))
(.resize this))
(.unshift this x))
;; Doubles the size of the buffer while retaining all the existing values
(resize
[_]
(let [new-arr-size (* (alength arr) 2)
new-arr (make-array new-arr-size)]
(cond
(< tail head)
(do (acopy arr tail new-arr 0 length)
(set! tail 0)
(set! head length)
(set! arr new-arr))
(> tail head)
(do (acopy arr tail new-arr 0 (- (alength arr) tail))
(acopy arr 0 new-arr (- (alength arr) tail) head)
(set! tail 0)
(set! head length)
(set! arr new-arr))
(== tail head)
(do (set! tail 0)
(set! head 0)
(set! arr new-arr)))))
(cleanup [this keep?]
(dotimes [x length]
(let [v (.pop this)]
(when ^boolean (keep? v)
(.unshift this v))))))
(defn ring-buffer [n]
(assert (> n 0) "Can't create a ring buffer of size 0")
(RingBuffer. 0 0 0 (make-array n)))
;; -----------------------------------------------------------------------------
(deftype FixedBuffer [buf n]
impl/Buffer
(full? [this]
(== (.-length buf) n))
(remove! [this]
(.pop buf))
(add!* [this itm]
(.unbounded-unshift buf itm)
this)
cljs.core/ICounted
(-count [this]
(.-length buf)))
(defn fixed-buffer [n]
(FixedBuffer. (ring-buffer n) n))
(deftype DroppingBuffer [buf n]
impl/UnblockingBuffer
impl/Buffer
(full? [this]
false)
(remove! [this]
(.pop buf))
(add!* [this itm]
(when-not (== (.-length buf) n)
(.unshift buf itm))
this)
cljs.core/ICounted
(-count [this]
(.-length buf)))
(defn dropping-buffer [n]
(DroppingBuffer. (ring-buffer n) n))
(deftype SlidingBuffer [buf n]
impl/UnblockingBuffer
impl/Buffer
(full? [this]
false)
(remove! [this]
(.pop buf))
(add!* [this itm]
(when (== (.-length buf) n)
(impl/remove! this))
(.unshift buf itm)
this)
cljs.core/ICounted
(-count [this]
(.-length buf)))
(defn sliding-buffer [n]
(SlidingBuffer. (ring-buffer n) n))
+359
View File
@@ -0,0 +1,359 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.core.async.impl.buffers');
goog.require('cljs.core');
goog.require('cljs.core.constants');
goog.require('cljs.core.async.impl.protocols');
cljs.core.async.impl.buffers.acopy = (function cljs$core$async$impl$buffers$acopy(src,src_start,dest,dest_start,len){
var cnt = (0);
while(true){
if((cnt < len)){
(dest[(dest_start + cnt)] = (src[(src_start + cnt)]));
var G__5703 = (cnt + (1));
cnt = G__5703;
continue;
} else {
return null;
}
break;
}
});
/**
* @constructor
* @implements {cljs.core.async.impl.buffers.Object}
*/
cljs.core.async.impl.buffers.RingBuffer = (function (head,tail,length,arr){
this.head = head;
this.tail = tail;
this.length = length;
this.arr = arr;
});
(cljs.core.async.impl.buffers.RingBuffer.prototype.pop = (function (){
var self__ = this;
var _ = this;
if((self__.length === (0))){
return null;
} else {
var x = (self__.arr[self__.tail]);
(self__.arr[self__.tail] = null);
(self__.tail = ((self__.tail + (1)) % self__.arr.length));
(self__.length = (self__.length - (1)));
return x;
}
}));
(cljs.core.async.impl.buffers.RingBuffer.prototype.unshift = (function (x){
var self__ = this;
var _ = this;
(self__.arr[self__.head] = x);
(self__.head = ((self__.head + (1)) % self__.arr.length));
(self__.length = (self__.length + (1)));
return null;
}));
(cljs.core.async.impl.buffers.RingBuffer.prototype.unbounded_unshift = (function (x){
var self__ = this;
var this$ = this;
if(((self__.length + (1)) === self__.arr.length)){
this$.resize();
} else {
}
return this$.unshift(x);
}));
(cljs.core.async.impl.buffers.RingBuffer.prototype.resize = (function (){
var self__ = this;
var _ = this;
var new_arr_size = (self__.arr.length * (2));
var new_arr = (new Array(new_arr_size));
if((self__.tail < self__.head)){
cljs.core.async.impl.buffers.acopy(self__.arr,self__.tail,new_arr,(0),self__.length);
(self__.tail = (0));
(self__.head = self__.length);
return (self__.arr = new_arr);
} else {
if((self__.tail > self__.head)){
cljs.core.async.impl.buffers.acopy(self__.arr,self__.tail,new_arr,(0),(self__.arr.length - self__.tail));
cljs.core.async.impl.buffers.acopy(self__.arr,(0),new_arr,(self__.arr.length - self__.tail),self__.head);
(self__.tail = (0));
(self__.head = self__.length);
return (self__.arr = new_arr);
} else {
if((self__.tail === self__.head)){
(self__.tail = (0));
(self__.head = (0));
return (self__.arr = new_arr);
} else {
return null;
}
}
}
}));
(cljs.core.async.impl.buffers.RingBuffer.prototype.cleanup = (function (keep_QMARK_){
var self__ = this;
var this$ = this;
var n__5636__auto__ = self__.length;
var x = (0);
while(true){
if((x < n__5636__auto__)){
var v_5704 = this$.pop();
if((keep_QMARK_.cljs$core$IFn$_invoke$arity$1 ? keep_QMARK_.cljs$core$IFn$_invoke$arity$1(v_5704) : keep_QMARK_.call(null,v_5704))){
this$.unshift(v_5704);
} else {
}
var G__5705 = (x + (1));
x = G__5705;
continue;
} else {
return null;
}
break;
}
}));
(cljs.core.async.impl.buffers.RingBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 4, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.with_meta(cljs.core.cst$sym$head,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.with_meta(cljs.core.cst$sym$tail,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.with_meta(cljs.core.cst$sym$length,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.with_meta(cljs.core.cst$sym$arr,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null))], null);
}));
(cljs.core.async.impl.buffers.RingBuffer.cljs$lang$type = true);
(cljs.core.async.impl.buffers.RingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/RingBuffer");
(cljs.core.async.impl.buffers.RingBuffer.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.buffers/RingBuffer");
}));
/**
* Positional factory function for cljs.core.async.impl.buffers/RingBuffer.
*/
cljs.core.async.impl.buffers.__GT_RingBuffer = (function cljs$core$async$impl$buffers$__GT_RingBuffer(head,tail,length,arr){
return (new cljs.core.async.impl.buffers.RingBuffer(head,tail,length,arr));
});
cljs.core.async.impl.buffers.ring_buffer = (function cljs$core$async$impl$buffers$ring_buffer(n){
if((n > (0))){
} else {
throw (new Error(["Assert failed: ","Can't create a ring buffer of size 0","\n","(> n 0)"].join('')));
}
return (new cljs.core.async.impl.buffers.RingBuffer((0),(0),(0),(new Array(n))));
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.FixedBuffer = (function (buf,n){
this.buf = buf;
this.n = n;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return (self__.buf.length === self__.n);
}));
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.pop();
}));
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
self__.buf.unbounded_unshift(itm);
return this$__$1;
}));
(cljs.core.async.impl.buffers.FixedBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.length;
}));
(cljs.core.async.impl.buffers.FixedBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$buf,cljs.core.cst$sym$n], null);
}));
(cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$type = true);
(cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/FixedBuffer");
(cljs.core.async.impl.buffers.FixedBuffer.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.buffers/FixedBuffer");
}));
/**
* Positional factory function for cljs.core.async.impl.buffers/FixedBuffer.
*/
cljs.core.async.impl.buffers.__GT_FixedBuffer = (function cljs$core$async$impl$buffers$__GT_FixedBuffer(buf,n){
return (new cljs.core.async.impl.buffers.FixedBuffer(buf,n));
});
cljs.core.async.impl.buffers.fixed_buffer = (function cljs$core$async$impl$buffers$fixed_buffer(n){
return (new cljs.core.async.impl.buffers.FixedBuffer(cljs.core.async.impl.buffers.ring_buffer(n),n));
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.DroppingBuffer = (function (buf,n){
this.buf = buf;
this.n = n;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return false;
}));
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.pop();
}));
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
if((self__.buf.length === self__.n)){
} else {
self__.buf.unshift(itm);
}
return this$__$1;
}));
(cljs.core.async.impl.buffers.DroppingBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.length;
}));
(cljs.core.async.impl.buffers.DroppingBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$buf,cljs.core.cst$sym$n], null);
}));
(cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$type = true);
(cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/DroppingBuffer");
(cljs.core.async.impl.buffers.DroppingBuffer.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.buffers/DroppingBuffer");
}));
/**
* Positional factory function for cljs.core.async.impl.buffers/DroppingBuffer.
*/
cljs.core.async.impl.buffers.__GT_DroppingBuffer = (function cljs$core$async$impl$buffers$__GT_DroppingBuffer(buf,n){
return (new cljs.core.async.impl.buffers.DroppingBuffer(buf,n));
});
cljs.core.async.impl.buffers.dropping_buffer = (function cljs$core$async$impl$buffers$dropping_buffer(n){
return (new cljs.core.async.impl.buffers.DroppingBuffer(cljs.core.async.impl.buffers.ring_buffer(n),n));
});
/**
* @constructor
* @implements {cljs.core.ICounted}
* @implements {cljs.core.async.impl.protocols.UnblockingBuffer}
* @implements {cljs.core.async.impl.protocols.Buffer}
*/
cljs.core.async.impl.buffers.SlidingBuffer = (function (buf,n){
this.buf = buf;
this.n = n;
this.cljs$lang$protocol_mask$partition0$ = 2;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$UnblockingBuffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return false;
}));
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.pop();
}));
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 = (function (this$,itm){
var self__ = this;
var this$__$1 = this;
if((self__.buf.length === self__.n)){
this$__$1.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null);
} else {
}
self__.buf.unshift(itm);
return this$__$1;
}));
(cljs.core.async.impl.buffers.SlidingBuffer.prototype.cljs$core$ICounted$_count$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
return self__.buf.length;
}));
(cljs.core.async.impl.buffers.SlidingBuffer.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$buf,cljs.core.cst$sym$n], null);
}));
(cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$type = true);
(cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$ctorStr = "cljs.core.async.impl.buffers/SlidingBuffer");
(cljs.core.async.impl.buffers.SlidingBuffer.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.buffers/SlidingBuffer");
}));
/**
* Positional factory function for cljs.core.async.impl.buffers/SlidingBuffer.
*/
cljs.core.async.impl.buffers.__GT_SlidingBuffer = (function cljs$core$async$impl$buffers$__GT_SlidingBuffer(buf,n){
return (new cljs.core.async.impl.buffers.SlidingBuffer(buf,n));
});
cljs.core.async.impl.buffers.sliding_buffer = (function cljs$core$async$impl$buffers$sliding_buffer(n){
return (new cljs.core.async.impl.buffers.SlidingBuffer(cljs.core.async.impl.buffers.ring_buffer(n),n));
});
+182
View File
@@ -0,0 +1,182 @@
;; Copyright (c) Rich Hickey and contributors. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.core.async.impl.channels
(:require [cljs.core.async.impl.protocols :as impl]
[cljs.core.async.impl.dispatch :as dispatch]
[cljs.core.async.impl.buffers :as buffers]))
(defn box [val]
(reify cljs.core/IDeref
(-deref [_] val)))
(deftype PutBox [handler val])
(defn put-active? [box]
(impl/active? (.-handler box)))
(def ^:const MAX_DIRTY 64)
(defprotocol MMC
(abort [this]))
(deftype ManyToManyChannel [takes ^:mutable dirty-takes puts ^:mutable dirty-puts ^not-native buf ^:mutable closed add!]
MMC
(abort [this]
(loop []
(let [putter (.pop puts)]
(when-not (nil? putter)
(let [^not-native put-handler (.-handler putter)
val (.-val putter)]
(if ^boolean (impl/active? put-handler)
(let [put-cb (impl/commit put-handler)]
(dispatch/run #(put-cb true)))
(recur))))))
(.cleanup puts (constantly false))
(impl/close! this))
impl/WritePort
(put! [this val ^not-native handler]
(assert (not (nil? val)) "Can't put nil in on a channel")
;; bug in CLJS compiler boolean inference - David
(let [^boolean closed closed]
(if (or closed (not ^boolean (impl/active? handler)))
(box (not closed))
(if (and buf (not (impl/full? buf)))
(do
(impl/commit handler)
(let [done? (reduced? (add! buf val))]
(loop []
(when (and (pos? (.-length takes)) (pos? (count buf)))
(let [^not-native taker (.pop takes)]
(if ^boolean (impl/active? taker)
(let [take-cb (impl/commit taker)
val (impl/remove! buf)]
(dispatch/run (fn [] (take-cb val))))
(recur)))))
(when done? (abort this))
(box true)))
(let [taker (loop []
(let [^not-native taker (.pop takes)]
(when taker
(if (impl/active? taker)
taker
(recur)))))]
(if taker
(let [take-cb (impl/commit taker)]
(impl/commit handler)
(dispatch/run (fn [] (take-cb val)))
(box true))
(do
(if (> dirty-puts MAX_DIRTY)
(do (set! dirty-puts 0)
(.cleanup puts put-active?))
(set! dirty-puts (inc dirty-puts)))
(assert (< (.-length puts) impl/MAX-QUEUE-SIZE)
(str "No more than " impl/MAX-QUEUE-SIZE
" pending puts are allowed on a single channel."
" Consider using a windowed buffer."))
(.unbounded-unshift puts (PutBox. handler val))
nil)))))))
impl/ReadPort
(take! [this ^not-native handler]
(if (not ^boolean (impl/active? handler))
nil
(if (and (not (nil? buf)) (pos? (count buf)))
(let [_ (impl/commit handler)
retval (box (impl/remove! buf))]
(loop []
(when-not (impl/full? buf)
(let [putter (.pop puts)]
(when-not (nil? putter)
(let [^not-native put-handler (.-handler putter)
val (.-val putter)]
(when ^boolean (impl/active? put-handler)
(let [put-cb (impl/commit put-handler)]
(impl/commit handler)
(dispatch/run #(put-cb true))
(when (reduced? (add! buf val))
(abort this)))))
(recur)))))
retval)
(let [putter (loop []
(let [putter (.pop puts)]
(when putter
(if ^boolean (impl/active? (.-handler putter))
putter
(recur)))))]
(if putter
(let [put-cb (impl/commit (.-handler putter))]
(impl/commit handler)
(dispatch/run #(put-cb true))
(box (.-val putter)))
(if closed
(do
(when buf (add! buf))
(if (and (impl/active? handler) (impl/commit handler))
(let [has-val (and buf (pos? (count buf)))]
(let [val (when has-val (impl/remove! buf))]
(box val)))
nil))
(do
(if (> dirty-takes MAX_DIRTY)
(do (set! dirty-takes 0)
(.cleanup takes impl/active?))
(set! dirty-takes (inc dirty-takes)))
(assert (< (.-length takes) impl/MAX-QUEUE-SIZE)
(str "No more than " impl/MAX-QUEUE-SIZE
" pending takes are allowed on a single channel."))
(.unbounded-unshift takes handler)
nil)))))))
impl/Channel
(closed? [_] closed)
(close! [this]
(if ^boolean closed
nil
(do (set! closed true)
(when (and buf (zero? (.-length puts)))
(add! buf))
(loop []
(let [^not-native taker (.pop takes)]
(when-not (nil? taker)
(when ^boolean (impl/active? taker)
(let [take-cb (impl/commit taker)
val (when (and buf (pos? (count buf))) (impl/remove! buf))]
(dispatch/run (fn [] (take-cb val)))))
(recur))))
nil))))
(defn- ex-handler [ex]
(.log js/console ex)
nil)
(defn- handle [buf exh t]
(let [else ((or exh ex-handler) t)]
(if (nil? else)
buf
(impl/add! buf else))))
(defn chan
([buf] (chan buf nil))
([buf xform] (chan buf xform nil))
([buf xform exh]
(ManyToManyChannel. (buffers/ring-buffer 32) 0 (buffers/ring-buffer 32)
0 buf false
(let [add! (if xform (xform impl/add!) impl/add!)]
(fn
([buf]
(try
(add! buf)
(catch :default t
(handle buf exh t))))
([buf val]
(try
(add! buf val)
(catch :default t
(handle buf exh t)))))))))
+540
View File
@@ -0,0 +1,540 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.core.async.impl.channels');
goog.require('cljs.core');
goog.require('cljs.core.constants');
goog.require('cljs.core.async.impl.protocols');
goog.require('cljs.core.async.impl.dispatch');
goog.require('cljs.core.async.impl.buffers');
cljs.core.async.impl.channels.box = (function cljs$core$async$impl$channels$box(val){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.impl !== 'undefined') && (typeof cljs.core.async.impl.channels !== 'undefined') && (typeof cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713 !== 'undefined')){
} else {
/**
* @constructor
* @implements {cljs.core.IMeta}
* @implements {cljs.core.IDeref}
* @implements {cljs.core.IWithMeta}
*/
cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713 = (function (val,meta5714){
this.val = val;
this.meta5714 = meta5714;
this.cljs$lang$protocol_mask$partition0$ = 425984;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_5715,meta5714__$1){
var self__ = this;
var _5715__$1 = this;
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713(self__.val,meta5714__$1));
}));
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_5715){
var self__ = this;
var _5715__$1 = this;
return self__.meta5714;
}));
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713.prototype.cljs$core$IDeref$_deref$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.val;
}));
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$val,cljs.core.cst$sym$meta5714], null);
}));
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713.cljs$lang$type = true);
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713.cljs$lang$ctorStr = "cljs.core.async.impl.channels/t_cljs$core$async$impl$channels5713");
(cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.channels/t_cljs$core$async$impl$channels5713");
}));
/**
* Positional factory function for cljs.core.async.impl.channels/t_cljs$core$async$impl$channels5713.
*/
cljs.core.async.impl.channels.__GT_t_cljs$core$async$impl$channels5713 = (function cljs$core$async$impl$channels$box_$___GT_t_cljs$core$async$impl$channels5713(val__$1,meta5714){
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713(val__$1,meta5714));
});
}
return (new cljs.core.async.impl.channels.t_cljs$core$async$impl$channels5713(val,cljs.core.PersistentArrayMap.EMPTY));
});
/**
* @constructor
*/
cljs.core.async.impl.channels.PutBox = (function (handler,val){
this.handler = handler;
this.val = val;
});
(cljs.core.async.impl.channels.PutBox.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$handler,cljs.core.cst$sym$val], null);
}));
(cljs.core.async.impl.channels.PutBox.cljs$lang$type = true);
(cljs.core.async.impl.channels.PutBox.cljs$lang$ctorStr = "cljs.core.async.impl.channels/PutBox");
(cljs.core.async.impl.channels.PutBox.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.channels/PutBox");
}));
/**
* Positional factory function for cljs.core.async.impl.channels/PutBox.
*/
cljs.core.async.impl.channels.__GT_PutBox = (function cljs$core$async$impl$channels$__GT_PutBox(handler,val){
return (new cljs.core.async.impl.channels.PutBox(handler,val));
});
cljs.core.async.impl.channels.put_active_QMARK_ = (function cljs$core$async$impl$channels$put_active_QMARK_(box){
return cljs.core.async.impl.protocols.active_QMARK_(box.handler);
});
cljs.core.async.impl.channels.MAX_DIRTY = (64);
/**
* @interface
*/
cljs.core.async.impl.channels.MMC = function(){};
var cljs$core$async$impl$channels$MMC$abort$dyn_5716 = (function (this$){
var x__5393__auto__ = (((this$ == null))?null:this$);
var m__5394__auto__ = (cljs.core.async.impl.channels.abort[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__5394__auto__.call(null,this$));
} else {
var m__5392__auto__ = (cljs.core.async.impl.channels.abort["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(this$) : m__5392__auto__.call(null,this$));
} else {
throw cljs.core.missing_protocol("MMC.abort",this$);
}
}
});
cljs.core.async.impl.channels.abort = (function cljs$core$async$impl$channels$abort(this$){
if((((!((this$ == null)))) && ((!((this$.cljs$core$async$impl$channels$MMC$abort$arity$1 == null)))))){
return this$.cljs$core$async$impl$channels$MMC$abort$arity$1(this$);
} else {
return cljs$core$async$impl$channels$MMC$abort$dyn_5716(this$);
}
});
/**
* @constructor
* @implements {cljs.core.async.impl.channels.MMC}
* @implements {cljs.core.async.impl.protocols.Channel}
* @implements {cljs.core.async.impl.protocols.WritePort}
* @implements {cljs.core.async.impl.protocols.ReadPort}
*/
cljs.core.async.impl.channels.ManyToManyChannel = (function (takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_){
this.takes = takes;
this.dirty_takes = dirty_takes;
this.puts = puts;
this.dirty_puts = dirty_puts;
this.buf = buf;
this.closed = closed;
this.add_BANG_ = add_BANG_;
});
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$channels$MMC$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$channels$MMC$abort$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
while(true){
var putter_5717 = self__.puts.pop();
if((putter_5717 == null)){
} else {
var put_handler_5718 = putter_5717.handler;
var val_5719 = putter_5717.val;
if(put_handler_5718.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
var put_cb_5720 = put_handler_5718.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
cljs.core.async.impl.dispatch.run(((function (put_cb_5720,put_handler_5718,val_5719,putter_5717,this$__$1){
return (function (){
return (put_cb_5720.cljs$core$IFn$_invoke$arity$1 ? put_cb_5720.cljs$core$IFn$_invoke$arity$1(true) : put_cb_5720.call(null,true));
});})(put_cb_5720,put_handler_5718,val_5719,putter_5717,this$__$1))
);
} else {
continue;
}
}
break;
}
self__.puts.cleanup(cljs.core.constantly(false));
return this$__$1.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(null);
}));
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$WritePort$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 = (function (this$,val,handler){
var self__ = this;
var this$__$1 = this;
if((!((val == null)))){
} else {
throw (new Error(["Assert failed: ","Can't put nil in on a channel","\n","(not (nil? val))"].join('')));
}
var closed__$1 = self__.closed;
if(((closed__$1) || ((!(handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)))))){
return cljs.core.async.impl.channels.box((!(closed__$1)));
} else {
if(cljs.core.truth_((function (){var and__5043__auto__ = self__.buf;
if(cljs.core.truth_(and__5043__auto__)){
return cljs.core.not(self__.buf.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(null));
} else {
return and__5043__auto__;
}
})())){
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
var done_QMARK_ = cljs.core.reduced_QMARK_((self__.add_BANG_.cljs$core$IFn$_invoke$arity$2 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$2(self__.buf,val) : self__.add_BANG_.call(null,self__.buf,val)));
while(true){
if((((self__.takes.length > (0))) && ((cljs.core.count(self__.buf) > (0))))){
var taker_5721 = self__.takes.pop();
if(taker_5721.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
var take_cb_5722 = taker_5721.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
var val_5723__$1 = self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null);
cljs.core.async.impl.dispatch.run(((function (take_cb_5722,val_5723__$1,taker_5721,done_QMARK_,closed__$1,this$__$1){
return (function (){
return (take_cb_5722.cljs$core$IFn$_invoke$arity$1 ? take_cb_5722.cljs$core$IFn$_invoke$arity$1(val_5723__$1) : take_cb_5722.call(null,val_5723__$1));
});})(take_cb_5722,val_5723__$1,taker_5721,done_QMARK_,closed__$1,this$__$1))
);
} else {
continue;
}
} else {
}
break;
}
if(done_QMARK_){
this$__$1.cljs$core$async$impl$channels$MMC$abort$arity$1(null);
} else {
}
return cljs.core.async.impl.channels.box(true);
} else {
var taker = (function (){while(true){
var taker = self__.takes.pop();
if(cljs.core.truth_(taker)){
if(cljs.core.truth_(taker.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null))){
return taker;
} else {
continue;
}
} else {
return null;
}
break;
}
})();
if(cljs.core.truth_(taker)){
var take_cb = taker.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
cljs.core.async.impl.dispatch.run((function (){
return (take_cb.cljs$core$IFn$_invoke$arity$1 ? take_cb.cljs$core$IFn$_invoke$arity$1(val) : take_cb.call(null,val));
}));
return cljs.core.async.impl.channels.box(true);
} else {
if((self__.dirty_puts > (64))){
(self__.dirty_puts = (0));
self__.puts.cleanup(cljs.core.async.impl.channels.put_active_QMARK_);
} else {
(self__.dirty_puts = (self__.dirty_puts + (1)));
}
if((self__.puts.length < (1024))){
} else {
throw (new Error(["Assert failed: ",["No more than ",cljs.core.str.cljs$core$IFn$_invoke$arity$1((1024))," pending puts are allowed on a single channel."," Consider using a windowed buffer."].join(''),"\n","(< (.-length puts) impl/MAX-QUEUE-SIZE)"].join('')));
}
self__.puts.unbounded_unshift((new cljs.core.async.impl.channels.PutBox(handler,val)));
return null;
}
}
}
}));
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$ReadPort$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 = (function (this$,handler){
var self__ = this;
var this$__$1 = this;
if((!(handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)))){
return null;
} else {
if((((!((self__.buf == null)))) && ((cljs.core.count(self__.buf) > (0))))){
var _ = handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
var retval = cljs.core.async.impl.channels.box(self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null));
while(true){
if(cljs.core.truth_(self__.buf.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(null))){
} else {
var putter_5724 = self__.puts.pop();
if((putter_5724 == null)){
} else {
var put_handler_5725 = putter_5724.handler;
var val_5726 = putter_5724.val;
if(put_handler_5725.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
var put_cb_5727 = put_handler_5725.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
cljs.core.async.impl.dispatch.run(((function (put_cb_5727,put_handler_5725,val_5726,putter_5724,_,retval,this$__$1){
return (function (){
return (put_cb_5727.cljs$core$IFn$_invoke$arity$1 ? put_cb_5727.cljs$core$IFn$_invoke$arity$1(true) : put_cb_5727.call(null,true));
});})(put_cb_5727,put_handler_5725,val_5726,putter_5724,_,retval,this$__$1))
);
if(cljs.core.reduced_QMARK_((self__.add_BANG_.cljs$core$IFn$_invoke$arity$2 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$2(self__.buf,val_5726) : self__.add_BANG_.call(null,self__.buf,val_5726)))){
this$__$1.cljs$core$async$impl$channels$MMC$abort$arity$1(null);
} else {
}
} else {
}
continue;
}
}
break;
}
return retval;
} else {
var putter = (function (){while(true){
var putter = self__.puts.pop();
if(cljs.core.truth_(putter)){
if(cljs.core.async.impl.protocols.active_QMARK_(putter.handler)){
return putter;
} else {
continue;
}
} else {
return null;
}
break;
}
})();
if(cljs.core.truth_(putter)){
var put_cb = cljs.core.async.impl.protocols.commit(putter.handler);
handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
cljs.core.async.impl.dispatch.run((function (){
return (put_cb.cljs$core$IFn$_invoke$arity$1 ? put_cb.cljs$core$IFn$_invoke$arity$1(true) : put_cb.call(null,true));
}));
return cljs.core.async.impl.channels.box(putter.val);
} else {
if(cljs.core.truth_(self__.closed)){
if(cljs.core.truth_(self__.buf)){
(self__.add_BANG_.cljs$core$IFn$_invoke$arity$1 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$1(self__.buf) : self__.add_BANG_.call(null,self__.buf));
} else {
}
if(cljs.core.truth_((function (){var and__5043__auto__ = handler.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null);
if(cljs.core.truth_(and__5043__auto__)){
return handler.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
} else {
return and__5043__auto__;
}
})())){
var has_val = (function (){var and__5043__auto__ = self__.buf;
if(cljs.core.truth_(and__5043__auto__)){
return (cljs.core.count(self__.buf) > (0));
} else {
return and__5043__auto__;
}
})();
var val = (cljs.core.truth_(has_val)?self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null):null);
return cljs.core.async.impl.channels.box(val);
} else {
return null;
}
} else {
if((self__.dirty_takes > (64))){
(self__.dirty_takes = (0));
self__.takes.cleanup(cljs.core.async.impl.protocols.active_QMARK_);
} else {
(self__.dirty_takes = (self__.dirty_takes + (1)));
}
if((self__.takes.length < (1024))){
} else {
throw (new Error(["Assert failed: ",["No more than ",cljs.core.str.cljs$core$IFn$_invoke$arity$1((1024))," pending takes are allowed on a single channel."].join(''),"\n","(< (.-length takes) impl/MAX-QUEUE-SIZE)"].join('')));
}
self__.takes.unbounded_unshift(handler);
return null;
}
}
}
}
}));
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.closed;
}));
(cljs.core.async.impl.channels.ManyToManyChannel.prototype.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 = (function (this$){
var self__ = this;
var this$__$1 = this;
if(self__.closed){
return null;
} else {
(self__.closed = true);
if(cljs.core.truth_((function (){var and__5043__auto__ = self__.buf;
if(cljs.core.truth_(and__5043__auto__)){
return (self__.puts.length === (0));
} else {
return and__5043__auto__;
}
})())){
(self__.add_BANG_.cljs$core$IFn$_invoke$arity$1 ? self__.add_BANG_.cljs$core$IFn$_invoke$arity$1(self__.buf) : self__.add_BANG_.call(null,self__.buf));
} else {
}
while(true){
var taker_5728 = self__.takes.pop();
if((taker_5728 == null)){
} else {
if(taker_5728.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(null)){
var take_cb_5729 = taker_5728.cljs$core$async$impl$protocols$Handler$commit$arity$1(null);
var val_5730 = (cljs.core.truth_((function (){var and__5043__auto__ = self__.buf;
if(cljs.core.truth_(and__5043__auto__)){
return (cljs.core.count(self__.buf) > (0));
} else {
return and__5043__auto__;
}
})())?self__.buf.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(null):null);
cljs.core.async.impl.dispatch.run(((function (take_cb_5729,val_5730,taker_5728,this$__$1){
return (function (){
return (take_cb_5729.cljs$core$IFn$_invoke$arity$1 ? take_cb_5729.cljs$core$IFn$_invoke$arity$1(val_5730) : take_cb_5729.call(null,val_5730));
});})(take_cb_5729,val_5730,taker_5728,this$__$1))
);
} else {
}
continue;
}
break;
}
return null;
}
}));
(cljs.core.async.impl.channels.ManyToManyChannel.getBasis = (function (){
return new cljs.core.PersistentVector(null, 7, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$takes,cljs.core.with_meta(cljs.core.cst$sym$dirty_DASH_takes,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.cst$sym$puts,cljs.core.with_meta(cljs.core.cst$sym$dirty_DASH_puts,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.with_meta(cljs.core.cst$sym$buf,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$tag,cljs.core.cst$sym$not_DASH_native], null)),cljs.core.with_meta(cljs.core.cst$sym$closed,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.cst$sym$add_BANG_], null);
}));
(cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$type = true);
(cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$ctorStr = "cljs.core.async.impl.channels/ManyToManyChannel");
(cljs.core.async.impl.channels.ManyToManyChannel.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.channels/ManyToManyChannel");
}));
/**
* Positional factory function for cljs.core.async.impl.channels/ManyToManyChannel.
*/
cljs.core.async.impl.channels.__GT_ManyToManyChannel = (function cljs$core$async$impl$channels$__GT_ManyToManyChannel(takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_){
return (new cljs.core.async.impl.channels.ManyToManyChannel(takes,dirty_takes,puts,dirty_puts,buf,closed,add_BANG_));
});
cljs.core.async.impl.channels.ex_handler = (function cljs$core$async$impl$channels$ex_handler(ex){
console.log(ex);
return null;
});
cljs.core.async.impl.channels.handle = (function cljs$core$async$impl$channels$handle(buf,exh,t){
var else$ = (function (){var fexpr__5731 = (function (){var or__5045__auto__ = exh;
if(cljs.core.truth_(or__5045__auto__)){
return or__5045__auto__;
} else {
return cljs.core.async.impl.channels.ex_handler;
}
})();
return (fexpr__5731.cljs$core$IFn$_invoke$arity$1 ? fexpr__5731.cljs$core$IFn$_invoke$arity$1(t) : fexpr__5731.call(null,t));
})();
if((else$ == null)){
return buf;
} else {
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2(buf,else$);
}
});
cljs.core.async.impl.channels.chan = (function cljs$core$async$impl$channels$chan(var_args){
var G__5733 = arguments.length;
switch (G__5733) {
case 1:
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
case 3:
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1 = (function (buf){
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2(buf,null);
}));
(cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$2 = (function (buf,xform){
return cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3(buf,xform,null);
}));
(cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$3 = (function (buf,xform,exh){
return (new cljs.core.async.impl.channels.ManyToManyChannel(cljs.core.async.impl.buffers.ring_buffer((32)),(0),cljs.core.async.impl.buffers.ring_buffer((32)),(0),buf,false,(function (){var add_BANG_ = (cljs.core.truth_(xform)?(xform.cljs$core$IFn$_invoke$arity$1 ? xform.cljs$core$IFn$_invoke$arity$1(cljs.core.async.impl.protocols.add_BANG_) : xform.call(null,cljs.core.async.impl.protocols.add_BANG_)):cljs.core.async.impl.protocols.add_BANG_);
return (function() {
var G__5737 = null;
var G__5737__1 = (function (buf__$1){
try{return (add_BANG_.cljs$core$IFn$_invoke$arity$1 ? add_BANG_.cljs$core$IFn$_invoke$arity$1(buf__$1) : add_BANG_.call(null,buf__$1));
}catch (e5734){var t = e5734;
return cljs.core.async.impl.channels.handle(buf__$1,exh,t);
}});
var G__5737__2 = (function (buf__$1,val){
try{return (add_BANG_.cljs$core$IFn$_invoke$arity$2 ? add_BANG_.cljs$core$IFn$_invoke$arity$2(buf__$1,val) : add_BANG_.call(null,buf__$1,val));
}catch (e5735){var t = e5735;
return cljs.core.async.impl.channels.handle(buf__$1,exh,t);
}});
G__5737 = function(buf__$1,val){
switch(arguments.length){
case 1:
return G__5737__1.call(this,buf__$1);
case 2:
return G__5737__2.call(this,buf__$1,val);
}
throw(new Error('Invalid arity: ' + arguments.length));
};
G__5737.cljs$core$IFn$_invoke$arity$1 = G__5737__1;
G__5737.cljs$core$IFn$_invoke$arity$2 = G__5737__2;
return G__5737;
})()
})()));
}));
(cljs.core.async.impl.channels.chan.cljs$lang$maxFixedArity = 3);
+37
View File
@@ -0,0 +1,37 @@
(ns cljs.core.async.impl.dispatch
(:require [cljs.core.async.impl.buffers :as buffers]
[goog.async.nextTick]))
(def tasks (buffers/ring-buffer 32))
(def running? false)
(def queued? false)
(def TASK_BATCH_SIZE 1024)
(declare queue-dispatcher)
(defn process-messages []
(set! running? true)
(set! queued? false)
(loop [count 0]
(let [m (.pop tasks)]
(when-not (nil? m)
(m)
(when (< count TASK_BATCH_SIZE)
(recur (inc count))))))
(set! running? false)
(when (> (.-length tasks) 0)
(queue-dispatcher)))
(defn queue-dispatcher []
(when-not (and queued? running?)
(set! queued? true)
(goog.async.nextTick process-messages)))
(defn run [f]
(.unbounded-unshift tasks f)
(queue-dispatcher))
(defn queue-delay [f delay]
(js/setTimeout f delay))
+57
View File
@@ -0,0 +1,57 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.core.async.impl.dispatch');
goog.require('cljs.core');
goog.require('cljs.core.constants');
goog.require('cljs.core.async.impl.buffers');
goog.require('goog.async.nextTick');
cljs.core.async.impl.dispatch.tasks = cljs.core.async.impl.buffers.ring_buffer((32));
cljs.core.async.impl.dispatch.running_QMARK_ = false;
cljs.core.async.impl.dispatch.queued_QMARK_ = false;
cljs.core.async.impl.dispatch.TASK_BATCH_SIZE = (1024);
cljs.core.async.impl.dispatch.process_messages = (function cljs$core$async$impl$dispatch$process_messages(){
(cljs.core.async.impl.dispatch.running_QMARK_ = true);
(cljs.core.async.impl.dispatch.queued_QMARK_ = false);
var count_5708 = (0);
while(true){
var m_5709 = cljs.core.async.impl.dispatch.tasks.pop();
if((m_5709 == null)){
} else {
(m_5709.cljs$core$IFn$_invoke$arity$0 ? m_5709.cljs$core$IFn$_invoke$arity$0() : m_5709.call(null));
if((count_5708 < cljs.core.async.impl.dispatch.TASK_BATCH_SIZE)){
var G__5710 = (count_5708 + (1));
count_5708 = G__5710;
continue;
} else {
}
}
break;
}
(cljs.core.async.impl.dispatch.running_QMARK_ = false);
if((cljs.core.async.impl.dispatch.tasks.length > (0))){
return (cljs.core.async.impl.dispatch.queue_dispatcher.cljs$core$IFn$_invoke$arity$0 ? cljs.core.async.impl.dispatch.queue_dispatcher.cljs$core$IFn$_invoke$arity$0() : cljs.core.async.impl.dispatch.queue_dispatcher.call(null));
} else {
return null;
}
});
cljs.core.async.impl.dispatch.queue_dispatcher = (function cljs$core$async$impl$dispatch$queue_dispatcher(){
if(((cljs.core.async.impl.dispatch.queued_QMARK_) && (cljs.core.async.impl.dispatch.running_QMARK_))){
return null;
} else {
(cljs.core.async.impl.dispatch.queued_QMARK_ = true);
return goog.async.nextTick(cljs.core.async.impl.dispatch.process_messages);
}
});
cljs.core.async.impl.dispatch.run = (function cljs$core$async$impl$dispatch$run(f){
cljs.core.async.impl.dispatch.tasks.unbounded_unshift(f);
return cljs.core.async.impl.dispatch.queue_dispatcher();
});
cljs.core.async.impl.dispatch.queue_delay = (function cljs$core$async$impl$dispatch$queue_delay(f,delay){
return setTimeout(f,delay);
});
+144
View File
@@ -0,0 +1,144 @@
(ns cljs.core.async.impl.ioc-helpers
(:require [cljs.core.async.impl.protocols :as impl])
(:require-macros [cljs.core.async.impl.ioc-macros :as ioc]))
(def ^:const FN-IDX 0)
(def ^:const STATE-IDX 1)
(def ^:const VALUE-IDX 2)
(def ^:const BINDINGS-IDX 3)
(def ^:const EXCEPTION-FRAMES 4)
(def ^:const CURRENT-EXCEPTION 5)
(def ^:const USER-START-IDX 6)
(defn aset-object [arr idx o]
(aget arr idx o))
(defn aget-object [arr idx]
(aget arr idx))
(defn finished?
"Returns true if the machine is in a finished state"
[state-array]
(keyword-identical? (aget state-array STATE-IDX) :finished))
(defn- fn-handler
[f]
(reify
impl/Handler
(active? [_] true)
(commit [_] f)))
(defn run-state-machine [state]
((aget-object state FN-IDX) state))
(defn run-state-machine-wrapped [state]
(try
(run-state-machine state)
(catch js/Object ex
(impl/close! ^not-native (aget-object state USER-START-IDX))
(throw ex))))
(defn take! [state blk ^not-native c]
(if-let [cb (impl/take! c (fn-handler
(fn [x]
(ioc/aset-all! state VALUE-IDX x STATE-IDX blk)
(run-state-machine-wrapped state))))]
(do (ioc/aset-all! state VALUE-IDX @cb STATE-IDX blk)
:recur)
nil))
(defn put! [state blk ^not-native c val]
(if-let [cb (impl/put! c val (fn-handler (fn [ret-val]
(ioc/aset-all! state VALUE-IDX ret-val STATE-IDX blk)
(run-state-machine-wrapped state))))]
(do (ioc/aset-all! state VALUE-IDX @cb STATE-IDX blk)
:recur)
nil))
(defn return-chan [state value]
(let [^not-native c (aget state USER-START-IDX)]
(when-not (nil? value)
(impl/put! c value (fn-handler (fn [] nil))))
(impl/close! c)
c))
(defrecord ExceptionFrame [catch-block
^Class catch-exception
finally-block
continue-block
prev])
(defn add-exception-frame [state catch-block catch-exception finally-block continue-block]
(ioc/aset-all! state
EXCEPTION-FRAMES
(->ExceptionFrame catch-block
catch-exception
finally-block
continue-block
(aget-object state EXCEPTION-FRAMES))))
(defn process-exception [state]
(let [exception-frame (aget-object state EXCEPTION-FRAMES)
catch-block (:catch-block exception-frame)
catch-exception (:catch-exception exception-frame)
exception (aget-object state CURRENT-EXCEPTION)]
(cond
(and exception
(not exception-frame))
(throw exception)
(and exception
catch-block
(instance? catch-exception exception))
(ioc/aset-all! state
STATE-IDX
catch-block
VALUE-IDX
exception
CURRENT-EXCEPTION
nil
EXCEPTION-FRAMES
(assoc exception-frame
:catch-block nil
:catch-exception nil))
(and exception
(not catch-block)
(not (:finally-block exception-frame)))
(do (ioc/aset-all! state
EXCEPTION-FRAMES
(:prev exception-frame))
(recur state))
(and exception
(not catch-block)
(:finally-block exception-frame))
(ioc/aset-all! state
STATE-IDX
(:finally-block exception-frame)
EXCEPTION-FRAMES
(assoc exception-frame
:finally-block nil))
(and (not exception)
(:finally-block exception-frame))
(do (ioc/aset-all! state
STATE-IDX
(:finally-block exception-frame)
EXCEPTION-FRAMES
(assoc exception-frame
:finally-block nil)))
(and (not exception)
(not (:finally-block exception-frame)))
(do (ioc/aset-all! state
STATE-IDX
(:continue-block exception-frame)
EXCEPTION-FRAMES
(:prev exception-frame)))
:else (throw (js/Error. "No matching clause")))))
+542
View File
@@ -0,0 +1,542 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.core.async.impl.ioc_helpers');
goog.require('cljs.core');
goog.require('cljs.core.constants');
goog.require('cljs.core.async.impl.protocols');
cljs.core.async.impl.ioc_helpers.FN_IDX = (0);
cljs.core.async.impl.ioc_helpers.STATE_IDX = (1);
cljs.core.async.impl.ioc_helpers.VALUE_IDX = (2);
cljs.core.async.impl.ioc_helpers.BINDINGS_IDX = (3);
cljs.core.async.impl.ioc_helpers.EXCEPTION_FRAMES = (4);
cljs.core.async.impl.ioc_helpers.CURRENT_EXCEPTION = (5);
cljs.core.async.impl.ioc_helpers.USER_START_IDX = (6);
cljs.core.async.impl.ioc_helpers.aset_object = (function cljs$core$async$impl$ioc_helpers$aset_object(arr,idx,o){
return (arr[idx][o]);
});
cljs.core.async.impl.ioc_helpers.aget_object = (function cljs$core$async$impl$ioc_helpers$aget_object(arr,idx){
return (arr[idx]);
});
/**
* Returns true if the machine is in a finished state
*/
cljs.core.async.impl.ioc_helpers.finished_QMARK_ = (function cljs$core$async$impl$ioc_helpers$finished_QMARK_(state_array){
return cljs.core.keyword_identical_QMARK_((state_array[(1)]),cljs.core.cst$kw$finished);
});
cljs.core.async.impl.ioc_helpers.fn_handler = (function cljs$core$async$impl$ioc_helpers$fn_handler(f){
if((typeof cljs !== 'undefined') && (typeof cljs.core !== 'undefined') && (typeof cljs.core.async !== 'undefined') && (typeof cljs.core.async.impl !== 'undefined') && (typeof cljs.core.async.impl.ioc_helpers !== 'undefined') && (typeof cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784 !== 'undefined')){
} else {
/**
* @constructor
* @implements {cljs.core.async.impl.protocols.Handler}
* @implements {cljs.core.IMeta}
* @implements {cljs.core.IWithMeta}
*/
cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784 = (function (f,meta8785){
this.f = f;
this.meta8785 = meta8785;
this.cljs$lang$protocol_mask$partition0$ = 393216;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (_8786,meta8785__$1){
var self__ = this;
var _8786__$1 = this;
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784(self__.f,meta8785__$1));
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784.prototype.cljs$core$IMeta$_meta$arity$1 = (function (_8786){
var self__ = this;
var _8786__$1 = this;
return self__.meta8785;
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784.prototype.cljs$core$async$impl$protocols$Handler$ = cljs.core.PROTOCOL_SENTINEL);
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784.prototype.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return true;
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784.prototype.cljs$core$async$impl$protocols$Handler$commit$arity$1 = (function (_){
var self__ = this;
var ___$1 = this;
return self__.f;
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$f,cljs.core.cst$sym$meta8785], null);
}));
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784.cljs$lang$type = true);
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784.cljs$lang$ctorStr = "cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers8784");
(cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers8784");
}));
/**
* Positional factory function for cljs.core.async.impl.ioc-helpers/t_cljs$core$async$impl$ioc_helpers8784.
*/
cljs.core.async.impl.ioc_helpers.__GT_t_cljs$core$async$impl$ioc_helpers8784 = (function cljs$core$async$impl$ioc_helpers$fn_handler_$___GT_t_cljs$core$async$impl$ioc_helpers8784(f__$1,meta8785){
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784(f__$1,meta8785));
});
}
return (new cljs.core.async.impl.ioc_helpers.t_cljs$core$async$impl$ioc_helpers8784(f,cljs.core.PersistentArrayMap.EMPTY));
});
cljs.core.async.impl.ioc_helpers.run_state_machine = (function cljs$core$async$impl$ioc_helpers$run_state_machine(state){
var fexpr__8787 = cljs.core.async.impl.ioc_helpers.aget_object(state,(0));
return (fexpr__8787.cljs$core$IFn$_invoke$arity$1 ? fexpr__8787.cljs$core$IFn$_invoke$arity$1(state) : fexpr__8787.call(null,state));
});
cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped = (function cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped(state){
try{return cljs.core.async.impl.ioc_helpers.run_state_machine(state);
}catch (e8788){if((e8788 instanceof Object)){
var ex = e8788;
cljs.core.async.impl.ioc_helpers.aget_object(state,(6)).cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(null);
throw ex;
} else {
throw e8788;
}
}});
cljs.core.async.impl.ioc_helpers.take_BANG_ = (function cljs$core$async$impl$ioc_helpers$take_BANG_(state,blk,c){
var temp__4655__auto__ = c.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2(null,cljs.core.async.impl.ioc_helpers.fn_handler((function (x){
var statearr_8789_8791 = state;
(statearr_8789_8791[(2)] = x);
(statearr_8789_8791[(1)] = blk);
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state);
})));
if(cljs.core.truth_(temp__4655__auto__)){
var cb = temp__4655__auto__;
var statearr_8790_8792 = state;
(statearr_8790_8792[(2)] = cljs.core.deref(cb));
(statearr_8790_8792[(1)] = blk);
return cljs.core.cst$kw$recur;
} else {
return null;
}
});
cljs.core.async.impl.ioc_helpers.put_BANG_ = (function cljs$core$async$impl$ioc_helpers$put_BANG_(state,blk,c,val){
var temp__4655__auto__ = c.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(null,val,cljs.core.async.impl.ioc_helpers.fn_handler((function (ret_val){
var statearr_8793_8795 = state;
(statearr_8793_8795[(2)] = ret_val);
(statearr_8793_8795[(1)] = blk);
return cljs.core.async.impl.ioc_helpers.run_state_machine_wrapped(state);
})));
if(cljs.core.truth_(temp__4655__auto__)){
var cb = temp__4655__auto__;
var statearr_8794_8796 = state;
(statearr_8794_8796[(2)] = cljs.core.deref(cb));
(statearr_8794_8796[(1)] = blk);
return cljs.core.cst$kw$recur;
} else {
return null;
}
});
cljs.core.async.impl.ioc_helpers.return_chan = (function cljs$core$async$impl$ioc_helpers$return_chan(state,value){
var c = (state[(6)]);
if((value == null)){
} else {
c.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(null,value,cljs.core.async.impl.ioc_helpers.fn_handler((function (){
return null;
})));
}
c.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(null);
return c;
});
/**
* @constructor
* @implements {cljs.core.IRecord}
* @implements {cljs.core.IKVReduce}
* @implements {cljs.core.IEquiv}
* @implements {cljs.core.IHash}
* @implements {cljs.core.ICollection}
* @implements {cljs.core.ICounted}
* @implements {cljs.core.ISeqable}
* @implements {cljs.core.IMeta}
* @implements {cljs.core.ICloneable}
* @implements {cljs.core.IPrintWithWriter}
* @implements {cljs.core.IIterable}
* @implements {cljs.core.IWithMeta}
* @implements {cljs.core.IAssociative}
* @implements {cljs.core.IMap}
* @implements {cljs.core.ILookup}
*/
cljs.core.async.impl.ioc_helpers.ExceptionFrame = (function (catch_block,catch_exception,finally_block,continue_block,prev,__meta,__extmap,__hash){
this.catch_block = catch_block;
this.catch_exception = catch_exception;
this.finally_block = finally_block;
this.continue_block = continue_block;
this.prev = prev;
this.__meta = __meta;
this.__extmap = __extmap;
this.__hash = __hash;
this.cljs$lang$protocol_mask$partition0$ = 2230716170;
this.cljs$lang$protocol_mask$partition1$ = 139264;
});
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ILookup$_lookup$arity$2 = (function (this__5343__auto__,k__5344__auto__){
var self__ = this;
var this__5343__auto____$1 = this;
return this__5343__auto____$1.cljs$core$ILookup$_lookup$arity$3(null,k__5344__auto__,null);
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ILookup$_lookup$arity$3 = (function (this__5345__auto__,k8798,else__5346__auto__){
var self__ = this;
var this__5345__auto____$1 = this;
var G__8802 = k8798;
var G__8802__$1 = (((G__8802 instanceof cljs.core.Keyword))?G__8802.fqn:null);
switch (G__8802__$1) {
case "catch-block":
return self__.catch_block;
break;
case "catch-exception":
return self__.catch_exception;
break;
case "finally-block":
return self__.finally_block;
break;
case "continue-block":
return self__.continue_block;
break;
case "prev":
return self__.prev;
break;
default:
return cljs.core.get.cljs$core$IFn$_invoke$arity$3(self__.__extmap,k8798,else__5346__auto__);
}
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IKVReduce$_kv_reduce$arity$3 = (function (this__5363__auto__,f__5364__auto__,init__5365__auto__){
var self__ = this;
var this__5363__auto____$1 = this;
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3((function (ret__5366__auto__,p__8803){
var vec__8804 = p__8803;
var k__5367__auto__ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__8804,(0),null);
var v__5368__auto__ = cljs.core.nth.cljs$core$IFn$_invoke$arity$3(vec__8804,(1),null);
return (f__5364__auto__.cljs$core$IFn$_invoke$arity$3 ? f__5364__auto__.cljs$core$IFn$_invoke$arity$3(ret__5366__auto__,k__5367__auto__,v__5368__auto__) : f__5364__auto__.call(null,ret__5366__auto__,k__5367__auto__,v__5368__auto__));
}),init__5365__auto__,this__5363__auto____$1);
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (this__5358__auto__,writer__5359__auto__,opts__5360__auto__){
var self__ = this;
var this__5358__auto____$1 = this;
var pr_pair__5361__auto__ = (function (keyval__5362__auto__){
return cljs.core.pr_sequential_writer(writer__5359__auto__,cljs.core.pr_writer,""," ","",opts__5360__auto__,keyval__5362__auto__);
});
return cljs.core.pr_sequential_writer(writer__5359__auto__,pr_pair__5361__auto__,"#cljs.core.async.impl.ioc-helpers.ExceptionFrame{",", ","}",opts__5360__auto__,cljs.core.concat.cljs$core$IFn$_invoke$arity$2(new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[cljs.core.cst$kw$catch_DASH_block,self__.catch_block],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[cljs.core.cst$kw$catch_DASH_exception,self__.catch_exception],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[cljs.core.cst$kw$finally_DASH_block,self__.finally_block],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[cljs.core.cst$kw$continue_DASH_block,self__.continue_block],null)),(new cljs.core.PersistentVector(null,2,(5),cljs.core.PersistentVector.EMPTY_NODE,[cljs.core.cst$kw$prev,self__.prev],null))], null),self__.__extmap));
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IIterable$_iterator$arity$1 = (function (G__8797){
var self__ = this;
var G__8797__$1 = this;
return (new cljs.core.RecordIter((0),G__8797__$1,5,new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$kw$catch_DASH_block,cljs.core.cst$kw$catch_DASH_exception,cljs.core.cst$kw$finally_DASH_block,cljs.core.cst$kw$continue_DASH_block,cljs.core.cst$kw$prev], null),(cljs.core.truth_(self__.__extmap)?cljs.core._iterator(self__.__extmap):cljs.core.nil_iter())));
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IMeta$_meta$arity$1 = (function (this__5341__auto__){
var self__ = this;
var this__5341__auto____$1 = this;
return self__.__meta;
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ICloneable$_clone$arity$1 = (function (this__5338__auto__){
var self__ = this;
var this__5338__auto____$1 = this;
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,self__.__extmap,self__.__hash));
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ICounted$_count$arity$1 = (function (this__5347__auto__){
var self__ = this;
var this__5347__auto____$1 = this;
return (5 + cljs.core.count(self__.__extmap));
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IHash$_hash$arity$1 = (function (this__5339__auto__){
var self__ = this;
var this__5339__auto____$1 = this;
var h__5154__auto__ = self__.__hash;
if((!((h__5154__auto__ == null)))){
return h__5154__auto__;
} else {
var h__5154__auto____$1 = (function (){var fexpr__8807 = (function (coll__5340__auto__){
return (846900531 ^ cljs.core.hash_unordered_coll(coll__5340__auto__));
});
return fexpr__8807(this__5339__auto____$1);
})();
(self__.__hash = h__5154__auto____$1);
return h__5154__auto____$1;
}
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IEquiv$_equiv$arity$2 = (function (this8799,other8800){
var self__ = this;
var this8799__$1 = this;
return (((!((other8800 == null)))) && ((((this8799__$1.constructor === other8800.constructor)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this8799__$1.catch_block,other8800.catch_block)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this8799__$1.catch_exception,other8800.catch_exception)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this8799__$1.finally_block,other8800.finally_block)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this8799__$1.continue_block,other8800.continue_block)) && (((cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this8799__$1.prev,other8800.prev)) && (cljs.core._EQ_.cljs$core$IFn$_invoke$arity$2(this8799__$1.__extmap,other8800.__extmap)))))))))))))));
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IMap$_dissoc$arity$2 = (function (this__5353__auto__,k__5354__auto__){
var self__ = this;
var this__5353__auto____$1 = this;
if(cljs.core.contains_QMARK_(new cljs.core.PersistentHashSet(null, new cljs.core.PersistentArrayMap(null, 5, [cljs.core.cst$kw$finally_DASH_block,null,cljs.core.cst$kw$catch_DASH_block,null,cljs.core.cst$kw$catch_DASH_exception,null,cljs.core.cst$kw$prev,null,cljs.core.cst$kw$continue_DASH_block,null], null), null),k__5354__auto__)){
return cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(cljs.core._with_meta(cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,this__5353__auto____$1),self__.__meta),k__5354__auto__);
} else {
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,cljs.core.not_empty(cljs.core.dissoc.cljs$core$IFn$_invoke$arity$2(self__.__extmap,k__5354__auto__)),null));
}
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IAssociative$_contains_key_QMARK_$arity$2 = (function (this__5350__auto__,k8798){
var self__ = this;
var this__5350__auto____$1 = this;
var G__8808 = k8798;
var G__8808__$1 = (((G__8808 instanceof cljs.core.Keyword))?G__8808.fqn:null);
switch (G__8808__$1) {
case "catch-block":
case "catch-exception":
case "finally-block":
case "continue-block":
case "prev":
return true;
break;
default:
return cljs.core.contains_QMARK_(self__.__extmap,k8798);
}
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IAssociative$_assoc$arity$3 = (function (this__5351__auto__,k__5352__auto__,G__8797){
var self__ = this;
var this__5351__auto____$1 = this;
var pred__8809 = cljs.core.keyword_identical_QMARK_;
var expr__8810 = k__5352__auto__;
if(cljs.core.truth_((function (){var G__8812 = cljs.core.cst$kw$catch_DASH_block;
var G__8813 = expr__8810;
return (pred__8809.cljs$core$IFn$_invoke$arity$2 ? pred__8809.cljs$core$IFn$_invoke$arity$2(G__8812,G__8813) : pred__8809.call(null,G__8812,G__8813));
})())){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(G__8797,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_((function (){var G__8814 = cljs.core.cst$kw$catch_DASH_exception;
var G__8815 = expr__8810;
return (pred__8809.cljs$core$IFn$_invoke$arity$2 ? pred__8809.cljs$core$IFn$_invoke$arity$2(G__8814,G__8815) : pred__8809.call(null,G__8814,G__8815));
})())){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,G__8797,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_((function (){var G__8816 = cljs.core.cst$kw$finally_DASH_block;
var G__8817 = expr__8810;
return (pred__8809.cljs$core$IFn$_invoke$arity$2 ? pred__8809.cljs$core$IFn$_invoke$arity$2(G__8816,G__8817) : pred__8809.call(null,G__8816,G__8817));
})())){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,G__8797,self__.continue_block,self__.prev,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_((function (){var G__8818 = cljs.core.cst$kw$continue_DASH_block;
var G__8819 = expr__8810;
return (pred__8809.cljs$core$IFn$_invoke$arity$2 ? pred__8809.cljs$core$IFn$_invoke$arity$2(G__8818,G__8819) : pred__8809.call(null,G__8818,G__8819));
})())){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,G__8797,self__.prev,self__.__meta,self__.__extmap,null));
} else {
if(cljs.core.truth_((function (){var G__8820 = cljs.core.cst$kw$prev;
var G__8821 = expr__8810;
return (pred__8809.cljs$core$IFn$_invoke$arity$2 ? pred__8809.cljs$core$IFn$_invoke$arity$2(G__8820,G__8821) : pred__8809.call(null,G__8820,G__8821));
})())){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,G__8797,self__.__meta,self__.__extmap,null));
} else {
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,self__.__meta,cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(self__.__extmap,k__5352__auto__,G__8797),null));
}
}
}
}
}
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (this__5356__auto__){
var self__ = this;
var this__5356__auto____$1 = this;
return cljs.core.seq(cljs.core.concat.cljs$core$IFn$_invoke$arity$2(new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [(new cljs.core.MapEntry(cljs.core.cst$kw$catch_DASH_block,self__.catch_block,null)),(new cljs.core.MapEntry(cljs.core.cst$kw$catch_DASH_exception,self__.catch_exception,null)),(new cljs.core.MapEntry(cljs.core.cst$kw$finally_DASH_block,self__.finally_block,null)),(new cljs.core.MapEntry(cljs.core.cst$kw$continue_DASH_block,self__.continue_block,null)),(new cljs.core.MapEntry(cljs.core.cst$kw$prev,self__.prev,null))], null),self__.__extmap));
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$IWithMeta$_with_meta$arity$2 = (function (this__5342__auto__,G__8797){
var self__ = this;
var this__5342__auto____$1 = this;
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(self__.catch_block,self__.catch_exception,self__.finally_block,self__.continue_block,self__.prev,G__8797,self__.__extmap,self__.__hash));
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.prototype.cljs$core$ICollection$_conj$arity$2 = (function (this__5348__auto__,entry__5349__auto__){
var self__ = this;
var this__5348__auto____$1 = this;
if(cljs.core.vector_QMARK_(entry__5349__auto__)){
return this__5348__auto____$1.cljs$core$IAssociative$_assoc$arity$3(null,cljs.core._nth.cljs$core$IFn$_invoke$arity$2(entry__5349__auto__,(0)),cljs.core._nth.cljs$core$IFn$_invoke$arity$2(entry__5349__auto__,(1)));
} else {
return cljs.core.reduce.cljs$core$IFn$_invoke$arity$3(cljs.core._conj,this__5348__auto____$1,entry__5349__auto__);
}
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.getBasis = (function (){
return new cljs.core.PersistentVector(null, 5, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$catch_DASH_block,cljs.core.with_meta(cljs.core.cst$sym$catch_DASH_exception,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$tag,cljs.core.cst$sym$Class], null)),cljs.core.cst$sym$finally_DASH_block,cljs.core.cst$sym$continue_DASH_block,cljs.core.cst$sym$prev], null);
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.cljs$lang$type = true);
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.cljs$lang$ctorPrSeq = (function (this__5389__auto__){
return (new cljs.core.List(null,"cljs.core.async.impl.ioc-helpers/ExceptionFrame",null,(1),null));
}));
(cljs.core.async.impl.ioc_helpers.ExceptionFrame.cljs$lang$ctorPrWriter = (function (this__5389__auto__,writer__5390__auto__){
return cljs.core._write(writer__5390__auto__,"cljs.core.async.impl.ioc-helpers/ExceptionFrame");
}));
/**
* Positional factory function for cljs.core.async.impl.ioc-helpers/ExceptionFrame.
*/
cljs.core.async.impl.ioc_helpers.__GT_ExceptionFrame = (function cljs$core$async$impl$ioc_helpers$__GT_ExceptionFrame(catch_block,catch_exception,finally_block,continue_block,prev){
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(catch_block,catch_exception,finally_block,continue_block,prev,null,null,null));
});
/**
* Factory function for cljs.core.async.impl.ioc-helpers/ExceptionFrame, taking a map of keywords to field values.
*/
cljs.core.async.impl.ioc_helpers.map__GT_ExceptionFrame = (function cljs$core$async$impl$ioc_helpers$map__GT_ExceptionFrame(G__8801){
var extmap__5385__auto__ = (function (){var G__8822 = cljs.core.dissoc.cljs$core$IFn$_invoke$arity$variadic(G__8801,cljs.core.cst$kw$catch_DASH_block,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.core.cst$kw$catch_DASH_exception,cljs.core.cst$kw$finally_DASH_block,cljs.core.cst$kw$continue_DASH_block,cljs.core.cst$kw$prev], 0));
if(cljs.core.record_QMARK_(G__8801)){
return cljs.core.into.cljs$core$IFn$_invoke$arity$2(cljs.core.PersistentArrayMap.EMPTY,G__8822);
} else {
return G__8822;
}
})();
return (new cljs.core.async.impl.ioc_helpers.ExceptionFrame(cljs.core.cst$kw$catch_DASH_block.cljs$core$IFn$_invoke$arity$1(G__8801),cljs.core.cst$kw$catch_DASH_exception.cljs$core$IFn$_invoke$arity$1(G__8801),cljs.core.cst$kw$finally_DASH_block.cljs$core$IFn$_invoke$arity$1(G__8801),cljs.core.cst$kw$continue_DASH_block.cljs$core$IFn$_invoke$arity$1(G__8801),cljs.core.cst$kw$prev.cljs$core$IFn$_invoke$arity$1(G__8801),null,cljs.core.not_empty(extmap__5385__auto__),null));
});
cljs.core.async.impl.ioc_helpers.add_exception_frame = (function cljs$core$async$impl$ioc_helpers$add_exception_frame(state,catch_block,catch_exception,finally_block,continue_block){
var statearr_8825 = state;
(statearr_8825[(4)] = cljs.core.async.impl.ioc_helpers.__GT_ExceptionFrame(catch_block,catch_exception,finally_block,continue_block,cljs.core.async.impl.ioc_helpers.aget_object(state,(4))));
return statearr_8825;
});
cljs.core.async.impl.ioc_helpers.process_exception = (function cljs$core$async$impl$ioc_helpers$process_exception(state){
while(true){
var exception_frame = cljs.core.async.impl.ioc_helpers.aget_object(state,(4));
var catch_block = cljs.core.cst$kw$catch_DASH_block.cljs$core$IFn$_invoke$arity$1(exception_frame);
var catch_exception = cljs.core.cst$kw$catch_DASH_exception.cljs$core$IFn$_invoke$arity$1(exception_frame);
var exception = cljs.core.async.impl.ioc_helpers.aget_object(state,(5));
if(cljs.core.truth_((function (){var and__5043__auto__ = exception;
if(cljs.core.truth_(and__5043__auto__)){
return cljs.core.not(exception_frame);
} else {
return and__5043__auto__;
}
})())){
throw exception;
} else {
if(cljs.core.truth_((function (){var and__5043__auto__ = exception;
if(cljs.core.truth_(and__5043__auto__)){
var and__5043__auto____$1 = catch_block;
if(cljs.core.truth_(and__5043__auto____$1)){
return (exception instanceof catch_exception);
} else {
return and__5043__auto____$1;
}
} else {
return and__5043__auto__;
}
})())){
var statearr_8826 = state;
(statearr_8826[(1)] = catch_block);
(statearr_8826[(2)] = exception);
(statearr_8826[(5)] = null);
(statearr_8826[(4)] = cljs.core.assoc.cljs$core$IFn$_invoke$arity$variadic(exception_frame,cljs.core.cst$kw$catch_DASH_block,null,cljs.core.prim_seq.cljs$core$IFn$_invoke$arity$2([cljs.core.cst$kw$catch_DASH_exception,null], 0)));
return statearr_8826;
} else {
if(cljs.core.truth_((function (){var and__5043__auto__ = exception;
if(cljs.core.truth_(and__5043__auto__)){
return ((cljs.core.not(catch_block)) && (cljs.core.not(cljs.core.cst$kw$finally_DASH_block.cljs$core$IFn$_invoke$arity$1(exception_frame))));
} else {
return and__5043__auto__;
}
})())){
var statearr_8827_8831 = state;
(statearr_8827_8831[(4)] = cljs.core.cst$kw$prev.cljs$core$IFn$_invoke$arity$1(exception_frame));
var G__8832 = state;
state = G__8832;
continue;
} else {
if(cljs.core.truth_((function (){var and__5043__auto__ = exception;
if(cljs.core.truth_(and__5043__auto__)){
var and__5043__auto____$1 = cljs.core.not(catch_block);
if(and__5043__auto____$1){
return cljs.core.cst$kw$finally_DASH_block.cljs$core$IFn$_invoke$arity$1(exception_frame);
} else {
return and__5043__auto____$1;
}
} else {
return and__5043__auto__;
}
})())){
var statearr_8828 = state;
(statearr_8828[(1)] = cljs.core.cst$kw$finally_DASH_block.cljs$core$IFn$_invoke$arity$1(exception_frame));
(statearr_8828[(4)] = cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(exception_frame,cljs.core.cst$kw$finally_DASH_block,null));
return statearr_8828;
} else {
if(cljs.core.truth_((function (){var and__5043__auto__ = cljs.core.not(exception);
if(and__5043__auto__){
return cljs.core.cst$kw$finally_DASH_block.cljs$core$IFn$_invoke$arity$1(exception_frame);
} else {
return and__5043__auto__;
}
})())){
var statearr_8829 = state;
(statearr_8829[(1)] = cljs.core.cst$kw$finally_DASH_block.cljs$core$IFn$_invoke$arity$1(exception_frame));
(statearr_8829[(4)] = cljs.core.assoc.cljs$core$IFn$_invoke$arity$3(exception_frame,cljs.core.cst$kw$finally_DASH_block,null));
return statearr_8829;
} else {
if(((cljs.core.not(exception)) && (cljs.core.not(cljs.core.cst$kw$finally_DASH_block.cljs$core$IFn$_invoke$arity$1(exception_frame))))){
var statearr_8830 = state;
(statearr_8830[(1)] = cljs.core.cst$kw$continue_DASH_block.cljs$core$IFn$_invoke$arity$1(exception_frame));
(statearr_8830[(4)] = cljs.core.cst$kw$prev.cljs$core$IFn$_invoke$arity$1(exception_frame));
return statearr_8830;
} else {
throw (new Error("No matching clause"));
}
}
}
}
}
}
break;
}
});
+41
View File
@@ -0,0 +1,41 @@
;; Copyright (c) Rich Hickey and contributors. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.core.async.impl.protocols)
(def ^:const MAX-QUEUE-SIZE 1024)
(defprotocol ReadPort
(take! [port fn1-handler] "derefable val if taken, nil if take was enqueued"))
(defprotocol WritePort
(put! [port val fn1-handler] "derefable boolean (false if already closed) if handled, nil if put was enqueued.
Must throw on nil val."))
(defprotocol Channel
(close! [chan])
(closed? [chan]))
(defprotocol Handler
(active? [h] "returns true if has callback. Must work w/o lock")
#_(lock-id [h] "a unique id for lock acquisition order, 0 if no lock")
(commit [h] "commit to fulfilling its end of the transfer, returns cb. Must be called within lock"))
(defprotocol Buffer
(full? [b])
(remove! [b])
(add!* [b itm]))
(defn add!
([b] b)
([b itm]
(assert (not (nil? itm)))
(add!* b itm)))
;; Defines a buffer that will never block (return true to full?)
(defprotocol UnblockingBuffer)
+284
View File
@@ -0,0 +1,284 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.core.async.impl.protocols');
goog.require('cljs.core');
goog.require('cljs.core.constants');
cljs.core.async.impl.protocols.MAX_QUEUE_SIZE = (1024);
/**
* @interface
*/
cljs.core.async.impl.protocols.ReadPort = function(){};
var cljs$core$async$impl$protocols$ReadPort$take_BANG_$dyn_5689 = (function (port,fn1_handler){
var x__5393__auto__ = (((port == null))?null:port);
var m__5394__auto__ = (cljs.core.async.impl.protocols.take_BANG_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$2(port,fn1_handler) : m__5394__auto__.call(null,port,fn1_handler));
} else {
var m__5392__auto__ = (cljs.core.async.impl.protocols.take_BANG_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$2(port,fn1_handler) : m__5392__auto__.call(null,port,fn1_handler));
} else {
throw cljs.core.missing_protocol("ReadPort.take!",port);
}
}
});
/**
* derefable val if taken, nil if take was enqueued
*/
cljs.core.async.impl.protocols.take_BANG_ = (function cljs$core$async$impl$protocols$take_BANG_(port,fn1_handler){
if((((!((port == null)))) && ((!((port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2 == null)))))){
return port.cljs$core$async$impl$protocols$ReadPort$take_BANG_$arity$2(port,fn1_handler);
} else {
return cljs$core$async$impl$protocols$ReadPort$take_BANG_$dyn_5689(port,fn1_handler);
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.WritePort = function(){};
var cljs$core$async$impl$protocols$WritePort$put_BANG_$dyn_5690 = (function (port,val,fn1_handler){
var x__5393__auto__ = (((port == null))?null:port);
var m__5394__auto__ = (cljs.core.async.impl.protocols.put_BANG_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$3(port,val,fn1_handler) : m__5394__auto__.call(null,port,val,fn1_handler));
} else {
var m__5392__auto__ = (cljs.core.async.impl.protocols.put_BANG_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$3 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$3(port,val,fn1_handler) : m__5392__auto__.call(null,port,val,fn1_handler));
} else {
throw cljs.core.missing_protocol("WritePort.put!",port);
}
}
});
/**
* derefable boolean (false if already closed) if handled, nil if put was enqueued.
* Must throw on nil val.
*/
cljs.core.async.impl.protocols.put_BANG_ = (function cljs$core$async$impl$protocols$put_BANG_(port,val,fn1_handler){
if((((!((port == null)))) && ((!((port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3 == null)))))){
return port.cljs$core$async$impl$protocols$WritePort$put_BANG_$arity$3(port,val,fn1_handler);
} else {
return cljs$core$async$impl$protocols$WritePort$put_BANG_$dyn_5690(port,val,fn1_handler);
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.Channel = function(){};
var cljs$core$async$impl$protocols$Channel$close_BANG_$dyn_5691 = (function (chan){
var x__5393__auto__ = (((chan == null))?null:chan);
var m__5394__auto__ = (cljs.core.async.impl.protocols.close_BANG_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5394__auto__.call(null,chan));
} else {
var m__5392__auto__ = (cljs.core.async.impl.protocols.close_BANG_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5392__auto__.call(null,chan));
} else {
throw cljs.core.missing_protocol("Channel.close!",chan);
}
}
});
cljs.core.async.impl.protocols.close_BANG_ = (function cljs$core$async$impl$protocols$close_BANG_(chan){
if((((!((chan == null)))) && ((!((chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1 == null)))))){
return chan.cljs$core$async$impl$protocols$Channel$close_BANG_$arity$1(chan);
} else {
return cljs$core$async$impl$protocols$Channel$close_BANG_$dyn_5691(chan);
}
});
var cljs$core$async$impl$protocols$Channel$closed_QMARK_$dyn_5692 = (function (chan){
var x__5393__auto__ = (((chan == null))?null:chan);
var m__5394__auto__ = (cljs.core.async.impl.protocols.closed_QMARK_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5394__auto__.call(null,chan));
} else {
var m__5392__auto__ = (cljs.core.async.impl.protocols.closed_QMARK_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(chan) : m__5392__auto__.call(null,chan));
} else {
throw cljs.core.missing_protocol("Channel.closed?",chan);
}
}
});
cljs.core.async.impl.protocols.closed_QMARK_ = (function cljs$core$async$impl$protocols$closed_QMARK_(chan){
if((((!((chan == null)))) && ((!((chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1 == null)))))){
return chan.cljs$core$async$impl$protocols$Channel$closed_QMARK_$arity$1(chan);
} else {
return cljs$core$async$impl$protocols$Channel$closed_QMARK_$dyn_5692(chan);
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.Handler = function(){};
var cljs$core$async$impl$protocols$Handler$active_QMARK_$dyn_5693 = (function (h){
var x__5393__auto__ = (((h == null))?null:h);
var m__5394__auto__ = (cljs.core.async.impl.protocols.active_QMARK_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5394__auto__.call(null,h));
} else {
var m__5392__auto__ = (cljs.core.async.impl.protocols.active_QMARK_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5392__auto__.call(null,h));
} else {
throw cljs.core.missing_protocol("Handler.active?",h);
}
}
});
/**
* returns true if has callback. Must work w/o lock
*/
cljs.core.async.impl.protocols.active_QMARK_ = (function cljs$core$async$impl$protocols$active_QMARK_(h){
if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1 == null)))))){
return h.cljs$core$async$impl$protocols$Handler$active_QMARK_$arity$1(h);
} else {
return cljs$core$async$impl$protocols$Handler$active_QMARK_$dyn_5693(h);
}
});
var cljs$core$async$impl$protocols$Handler$commit$dyn_5694 = (function (h){
var x__5393__auto__ = (((h == null))?null:h);
var m__5394__auto__ = (cljs.core.async.impl.protocols.commit[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5394__auto__.call(null,h));
} else {
var m__5392__auto__ = (cljs.core.async.impl.protocols.commit["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(h) : m__5392__auto__.call(null,h));
} else {
throw cljs.core.missing_protocol("Handler.commit",h);
}
}
});
/**
* commit to fulfilling its end of the transfer, returns cb. Must be called within lock
*/
cljs.core.async.impl.protocols.commit = (function cljs$core$async$impl$protocols$commit(h){
if((((!((h == null)))) && ((!((h.cljs$core$async$impl$protocols$Handler$commit$arity$1 == null)))))){
return h.cljs$core$async$impl$protocols$Handler$commit$arity$1(h);
} else {
return cljs$core$async$impl$protocols$Handler$commit$dyn_5694(h);
}
});
/**
* @interface
*/
cljs.core.async.impl.protocols.Buffer = function(){};
var cljs$core$async$impl$protocols$Buffer$full_QMARK_$dyn_5695 = (function (b){
var x__5393__auto__ = (((b == null))?null:b);
var m__5394__auto__ = (cljs.core.async.impl.protocols.full_QMARK_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5394__auto__.call(null,b));
} else {
var m__5392__auto__ = (cljs.core.async.impl.protocols.full_QMARK_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5392__auto__.call(null,b));
} else {
throw cljs.core.missing_protocol("Buffer.full?",b);
}
}
});
cljs.core.async.impl.protocols.full_QMARK_ = (function cljs$core$async$impl$protocols$full_QMARK_(b){
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1 == null)))))){
return b.cljs$core$async$impl$protocols$Buffer$full_QMARK_$arity$1(b);
} else {
return cljs$core$async$impl$protocols$Buffer$full_QMARK_$dyn_5695(b);
}
});
var cljs$core$async$impl$protocols$Buffer$remove_BANG_$dyn_5696 = (function (b){
var x__5393__auto__ = (((b == null))?null:b);
var m__5394__auto__ = (cljs.core.async.impl.protocols.remove_BANG_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5394__auto__.call(null,b));
} else {
var m__5392__auto__ = (cljs.core.async.impl.protocols.remove_BANG_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$1 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$1(b) : m__5392__auto__.call(null,b));
} else {
throw cljs.core.missing_protocol("Buffer.remove!",b);
}
}
});
cljs.core.async.impl.protocols.remove_BANG_ = (function cljs$core$async$impl$protocols$remove_BANG_(b){
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1 == null)))))){
return b.cljs$core$async$impl$protocols$Buffer$remove_BANG_$arity$1(b);
} else {
return cljs$core$async$impl$protocols$Buffer$remove_BANG_$dyn_5696(b);
}
});
var cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$dyn_5697 = (function (b,itm){
var x__5393__auto__ = (((b == null))?null:b);
var m__5394__auto__ = (cljs.core.async.impl.protocols.add_BANG__STAR_[goog.typeOf(x__5393__auto__)]);
if((!((m__5394__auto__ == null)))){
return (m__5394__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5394__auto__.cljs$core$IFn$_invoke$arity$2(b,itm) : m__5394__auto__.call(null,b,itm));
} else {
var m__5392__auto__ = (cljs.core.async.impl.protocols.add_BANG__STAR_["_"]);
if((!((m__5392__auto__ == null)))){
return (m__5392__auto__.cljs$core$IFn$_invoke$arity$2 ? m__5392__auto__.cljs$core$IFn$_invoke$arity$2(b,itm) : m__5392__auto__.call(null,b,itm));
} else {
throw cljs.core.missing_protocol("Buffer.add!*",b);
}
}
});
cljs.core.async.impl.protocols.add_BANG__STAR_ = (function cljs$core$async$impl$protocols$add_BANG__STAR_(b,itm){
if((((!((b == null)))) && ((!((b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2 == null)))))){
return b.cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$arity$2(b,itm);
} else {
return cljs$core$async$impl$protocols$Buffer$add_BANG__STAR_$dyn_5697(b,itm);
}
});
cljs.core.async.impl.protocols.add_BANG_ = (function cljs$core$async$impl$protocols$add_BANG_(var_args){
var G__5699 = arguments.length;
switch (G__5699) {
case 1:
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 2:
return cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2((arguments[(0)]),(arguments[(1)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$1 = (function (b){
return b;
}));
(cljs.core.async.impl.protocols.add_BANG_.cljs$core$IFn$_invoke$arity$2 = (function (b,itm){
if((!((itm == null)))){
} else {
throw (new Error("Assert failed: (not (nil? itm))"));
}
return cljs.core.async.impl.protocols.add_BANG__STAR_(b,itm);
}));
(cljs.core.async.impl.protocols.add_BANG_.cljs$lang$maxFixedArity = 2);
/**
* @interface
*/
cljs.core.async.impl.protocols.UnblockingBuffer = function(){};
+167
View File
@@ -0,0 +1,167 @@
;; Copyright (c) Rich Hickey and contributors. All rights reserved.
;; The use and distribution terms for this software are covered by the
;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this distribution.
;; By using this software in any fashion, you are agreeing to be bound by
;; the terms of this license.
;; You must not remove this notice, or any other, from this software.
(ns cljs.core.async.impl.timers
(:require [cljs.core.async.impl.protocols :as impl]
[cljs.core.async.impl.channels :as channels]
[cljs.core.async.impl.dispatch :as dispatch]))
(def MAX_LEVEL 15) ;; 16 levels
(def P (/ 1 2))
(defn random-level
([] (random-level 0))
([level]
(if (and (< (.random js/Math) P)
(< level MAX_LEVEL))
(recur (inc level))
level)))
(deftype SkipListNode [key ^:mutable val forward]
ISeqable
(-seq [coll]
(list key val))
IPrintWithWriter
(-pr-writer [coll writer opts]
(pr-sequential-writer writer pr-writer "[" " " "]" opts coll)))
(defn skip-list-node
([level] (skip-list-node nil nil level))
([k v level]
(let [arr (make-array (inc level))]
(loop [i 0]
(when (< i (alength arr))
(aset arr i nil)
(recur (inc i))))
(SkipListNode. k v arr))))
(defn least-greater-node
([x k level] (least-greater-node x k level nil))
([x k level update]
(if-not (neg? level)
(let [x (loop [x x]
(if-let [x' (aget (.-forward x) level)]
(if (< (.-key x') k)
(recur x')
x)
x))]
(when-not (nil? update)
(aset update level x))
(recur x k (dec level) update))
x)))
(deftype SkipList [header ^:mutable level]
Object
(put [coll k v]
(let [update (make-array MAX_LEVEL)
x (least-greater-node header k level update)
x (aget (.-forward x) 0)]
(if (and (not (nil? x)) (== (.-key x) k))
(set! (.-val x) v)
(let [new-level (random-level)]
(when (> new-level level)
(loop [i (inc level)]
(when (<= i (inc new-level))
(aset update i header)
(recur (inc i))))
(set! level new-level))
(let [x (skip-list-node k v (make-array new-level))]
(loop [i 0]
(when (<= i level)
(let [links (.-forward (aget update i))]
(aset (.-forward x) i (aget links i))
(aset links i x)))))))))
(remove [coll k]
(let [update (make-array MAX_LEVEL)
x (least-greater-node header k level update)
x (aget (.-forward x) 0)]
(when (and (not (nil? x)) (== (.-key x) k))
(loop [i 0]
(when (<= i level)
(let [links (.-forward (aget update i))]
(if (identical? (aget links i) x)
(do
(aset links i (aget (.-forward x) i))
(recur (inc i)))
(recur (inc i))))))
(while (and (> level 0)
(nil? (aget (.-forward header) level)))
(set! level (dec level))))))
(ceilingEntry [coll k]
(loop [x header level level]
(if-not (neg? level)
(let [nx (loop [x x]
(let [x' (aget (.-forward x) level)]
(when-not (nil? x')
(if (>= (.-key x') k)
x'
(recur x')))))]
(if-not (nil? nx)
(recur nx (dec level))
(recur x (dec level))))
(when-not (identical? x header)
x))))
(floorEntry [coll k]
(loop [x header level level]
(if-not (neg? level)
(let [nx (loop [x x]
(let [x' (aget (.-forward x) level)]
(if-not (nil? x')
(if (> (.-key x') k)
x
(recur x'))
(when (zero? level)
x))))]
(if nx
(recur nx (dec level))
(recur x (dec level))))
(when-not (identical? x header)
x))))
ISeqable
(-seq [coll]
(letfn [(iter [node]
(lazy-seq
(when-not (nil? node)
(cons [(.-key node) (.-val node)]
(iter (aget (.-forward node) 0))))))]
(iter (aget (.-forward header) 0))))
IPrintWithWriter
(-pr-writer [coll writer opts]
(let [pr-pair (fn [keyval]
(pr-sequential-writer writer pr-writer "" " " "" opts keyval))]
(pr-sequential-writer writer pr-pair "{" ", " "}" opts coll))))
(defn skip-list []
(SkipList. (skip-list-node 0) 0))
(def timeouts-map (skip-list))
(def TIMEOUT_RESOLUTION_MS 10)
(defn timeout
"returns a channel that will close after msecs"
[msecs]
(let [timeout (+ (.valueOf (js/Date.)) msecs)
me (.ceilingEntry timeouts-map timeout)]
(or (when (and me (< (.-key me) (+ timeout TIMEOUT_RESOLUTION_MS)))
(.-val me))
(let [timeout-channel (channels/chan nil)]
(.put timeouts-map timeout timeout-channel)
(dispatch/queue-delay
(fn []
(.remove timeouts-map timeout)
(impl/close! timeout-channel))
msecs)
timeout-channel))))
+470
View File
@@ -0,0 +1,470 @@
// Compiled by ClojureScript 1.11.60 {:static-fns true, :optimize-constants true, :optimizations :advanced}
goog.provide('cljs.core.async.impl.timers');
goog.require('cljs.core');
goog.require('cljs.core.constants');
goog.require('cljs.core.async.impl.protocols');
goog.require('cljs.core.async.impl.channels');
goog.require('cljs.core.async.impl.dispatch');
cljs.core.async.impl.timers.MAX_LEVEL = (15);
cljs.core.async.impl.timers.P = ((1) / (2));
cljs.core.async.impl.timers.random_level = (function cljs$core$async$impl$timers$random_level(var_args){
var G__8836 = arguments.length;
switch (G__8836) {
case 0:
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0();
break;
case 1:
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0 = (function (){
return cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1((0));
}));
(cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$1 = (function (level){
while(true){
if((((Math.random() < cljs.core.async.impl.timers.P)) && ((level < cljs.core.async.impl.timers.MAX_LEVEL)))){
var G__8838 = (level + (1));
level = G__8838;
continue;
} else {
return level;
}
break;
}
}));
(cljs.core.async.impl.timers.random_level.cljs$lang$maxFixedArity = 1);
/**
* @constructor
* @implements {cljs.core.ISeqable}
* @implements {cljs.core.IPrintWithWriter}
*/
cljs.core.async.impl.timers.SkipListNode = (function (key,val,forward){
this.key = key;
this.val = val;
this.forward = forward;
this.cljs$lang$protocol_mask$partition0$ = 2155872256;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.timers.SkipListNode.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (coll){
var self__ = this;
var coll__$1 = this;
return (new cljs.core.List(null,self__.key,(new cljs.core.List(null,self__.val,null,(1),null)),(2),null));
}));
(cljs.core.async.impl.timers.SkipListNode.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (coll,writer,opts){
var self__ = this;
var coll__$1 = this;
return cljs.core.pr_sequential_writer(writer,cljs.core.pr_writer,"["," ","]",opts,coll__$1);
}));
(cljs.core.async.impl.timers.SkipListNode.getBasis = (function (){
return new cljs.core.PersistentVector(null, 3, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$key,cljs.core.with_meta(cljs.core.cst$sym$val,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null)),cljs.core.cst$sym$forward], null);
}));
(cljs.core.async.impl.timers.SkipListNode.cljs$lang$type = true);
(cljs.core.async.impl.timers.SkipListNode.cljs$lang$ctorStr = "cljs.core.async.impl.timers/SkipListNode");
(cljs.core.async.impl.timers.SkipListNode.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.timers/SkipListNode");
}));
/**
* Positional factory function for cljs.core.async.impl.timers/SkipListNode.
*/
cljs.core.async.impl.timers.__GT_SkipListNode = (function cljs$core$async$impl$timers$__GT_SkipListNode(key,val,forward){
return (new cljs.core.async.impl.timers.SkipListNode(key,val,forward));
});
cljs.core.async.impl.timers.skip_list_node = (function cljs$core$async$impl$timers$skip_list_node(var_args){
var G__8840 = arguments.length;
switch (G__8840) {
case 1:
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1((arguments[(0)]));
break;
case 3:
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1 = (function (level){
return cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3(null,null,level);
}));
(cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3 = (function (k,v,level){
var arr = (new Array((level + (1))));
var i_8842 = (0);
while(true){
if((i_8842 < arr.length)){
(arr[i_8842] = null);
var G__8843 = (i_8842 + (1));
i_8842 = G__8843;
continue;
} else {
}
break;
}
return (new cljs.core.async.impl.timers.SkipListNode(k,v,arr));
}));
(cljs.core.async.impl.timers.skip_list_node.cljs$lang$maxFixedArity = 3);
cljs.core.async.impl.timers.least_greater_node = (function cljs$core$async$impl$timers$least_greater_node(var_args){
var G__8845 = arguments.length;
switch (G__8845) {
case 3:
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$3((arguments[(0)]),(arguments[(1)]),(arguments[(2)]));
break;
case 4:
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4((arguments[(0)]),(arguments[(1)]),(arguments[(2)]),(arguments[(3)]));
break;
default:
throw (new Error(["Invalid arity: ",cljs.core.str.cljs$core$IFn$_invoke$arity$1(arguments.length)].join('')));
}
});
(cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$3 = (function (x,k,level){
return cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4(x,k,level,null);
}));
(cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4 = (function (x,k,level,update){
while(true){
if((!((level < (0))))){
var x__$1 = (function (){var x__$1 = x;
while(true){
var temp__4655__auto__ = (x__$1.forward[level]);
if(cljs.core.truth_(temp__4655__auto__)){
var x_SINGLEQUOTE_ = temp__4655__auto__;
if((x_SINGLEQUOTE_.key < k)){
var G__8847 = x_SINGLEQUOTE_;
x__$1 = G__8847;
continue;
} else {
return x__$1;
}
} else {
return x__$1;
}
break;
}
})();
if((update == null)){
} else {
(update[level] = x__$1);
}
var G__8848 = x__$1;
var G__8849 = k;
var G__8850 = (level - (1));
var G__8851 = update;
x = G__8848;
k = G__8849;
level = G__8850;
update = G__8851;
continue;
} else {
return x;
}
break;
}
}));
(cljs.core.async.impl.timers.least_greater_node.cljs$lang$maxFixedArity = 4);
/**
* @constructor
* @implements {cljs.core.async.impl.timers.Object}
* @implements {cljs.core.ISeqable}
* @implements {cljs.core.IPrintWithWriter}
*/
cljs.core.async.impl.timers.SkipList = (function (header,level){
this.header = header;
this.level = level;
this.cljs$lang$protocol_mask$partition0$ = 2155872256;
this.cljs$lang$protocol_mask$partition1$ = 0;
});
(cljs.core.async.impl.timers.SkipList.prototype.put = (function (k,v){
var self__ = this;
var coll = this;
var update = (new Array(cljs.core.async.impl.timers.MAX_LEVEL));
var x = cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4(self__.header,k,self__.level,update);
var x__$1 = (x.forward[(0)]);
if((((!((x__$1 == null)))) && ((x__$1.key === k)))){
return (x__$1.val = v);
} else {
var new_level = cljs.core.async.impl.timers.random_level.cljs$core$IFn$_invoke$arity$0();
if((new_level > self__.level)){
var i_8852 = (self__.level + (1));
while(true){
if((i_8852 <= (new_level + (1)))){
(update[i_8852] = self__.header);
var G__8853 = (i_8852 + (1));
i_8852 = G__8853;
continue;
} else {
}
break;
}
(self__.level = new_level);
} else {
}
var x__$2 = cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$3(k,v,(new Array(new_level)));
var i = (0);
while(true){
if((i <= self__.level)){
var links = (update[i]).forward;
(x__$2.forward[i] = (links[i]));
return (links[i] = x__$2);
} else {
return null;
}
break;
}
}
}));
(cljs.core.async.impl.timers.SkipList.prototype.remove = (function (k){
var self__ = this;
var coll = this;
var update = (new Array(cljs.core.async.impl.timers.MAX_LEVEL));
var x = cljs.core.async.impl.timers.least_greater_node.cljs$core$IFn$_invoke$arity$4(self__.header,k,self__.level,update);
var x__$1 = (x.forward[(0)]);
if((((!((x__$1 == null)))) && ((x__$1.key === k)))){
var i_8854 = (0);
while(true){
if((i_8854 <= self__.level)){
var links_8855 = (update[i_8854]).forward;
if(((links_8855[i_8854]) === x__$1)){
(links_8855[i_8854] = (x__$1.forward[i_8854]));
var G__8856 = (i_8854 + (1));
i_8854 = G__8856;
continue;
} else {
var G__8857 = (i_8854 + (1));
i_8854 = G__8857;
continue;
}
} else {
}
break;
}
while(true){
if((((self__.level > (0))) && (((self__.header.forward[self__.level]) == null)))){
(self__.level = (self__.level - (1)));
continue;
} else {
return null;
}
break;
}
} else {
return null;
}
}));
(cljs.core.async.impl.timers.SkipList.prototype.ceilingEntry = (function (k){
var self__ = this;
var coll = this;
var x = self__.header;
var level__$1 = self__.level;
while(true){
if((!((level__$1 < (0))))){
var nx = (function (){var x__$1 = x;
while(true){
var x_SINGLEQUOTE_ = (x__$1.forward[level__$1]);
if((x_SINGLEQUOTE_ == null)){
return null;
} else {
if((x_SINGLEQUOTE_.key >= k)){
return x_SINGLEQUOTE_;
} else {
var G__8858 = x_SINGLEQUOTE_;
x__$1 = G__8858;
continue;
}
}
break;
}
})();
if((!((nx == null)))){
var G__8859 = nx;
var G__8860 = (level__$1 - (1));
x = G__8859;
level__$1 = G__8860;
continue;
} else {
var G__8861 = x;
var G__8862 = (level__$1 - (1));
x = G__8861;
level__$1 = G__8862;
continue;
}
} else {
if((x === self__.header)){
return null;
} else {
return x;
}
}
break;
}
}));
(cljs.core.async.impl.timers.SkipList.prototype.floorEntry = (function (k){
var self__ = this;
var coll = this;
var x = self__.header;
var level__$1 = self__.level;
while(true){
if((!((level__$1 < (0))))){
var nx = (function (){var x__$1 = x;
while(true){
var x_SINGLEQUOTE_ = (x__$1.forward[level__$1]);
if((!((x_SINGLEQUOTE_ == null)))){
if((x_SINGLEQUOTE_.key > k)){
return x__$1;
} else {
var G__8863 = x_SINGLEQUOTE_;
x__$1 = G__8863;
continue;
}
} else {
if((level__$1 === (0))){
return x__$1;
} else {
return null;
}
}
break;
}
})();
if(cljs.core.truth_(nx)){
var G__8864 = nx;
var G__8865 = (level__$1 - (1));
x = G__8864;
level__$1 = G__8865;
continue;
} else {
var G__8866 = x;
var G__8867 = (level__$1 - (1));
x = G__8866;
level__$1 = G__8867;
continue;
}
} else {
if((x === self__.header)){
return null;
} else {
return x;
}
}
break;
}
}));
(cljs.core.async.impl.timers.SkipList.prototype.cljs$core$ISeqable$_seq$arity$1 = (function (coll){
var self__ = this;
var coll__$1 = this;
var iter = (function cljs$core$async$impl$timers$iter(node){
return (new cljs.core.LazySeq(null,(function (){
if((node == null)){
return null;
} else {
return cljs.core.cons(new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [node.key,node.val], null),cljs$core$async$impl$timers$iter((node.forward[(0)])));
}
}),null,null));
});
return iter((self__.header.forward[(0)]));
}));
(cljs.core.async.impl.timers.SkipList.prototype.cljs$core$IPrintWithWriter$_pr_writer$arity$3 = (function (coll,writer,opts){
var self__ = this;
var coll__$1 = this;
var pr_pair = (function (keyval){
return cljs.core.pr_sequential_writer(writer,cljs.core.pr_writer,""," ","",opts,keyval);
});
return cljs.core.pr_sequential_writer(writer,pr_pair,"{",", ","}",opts,coll__$1);
}));
(cljs.core.async.impl.timers.SkipList.getBasis = (function (){
return new cljs.core.PersistentVector(null, 2, 5, cljs.core.PersistentVector.EMPTY_NODE, [cljs.core.cst$sym$header,cljs.core.with_meta(cljs.core.cst$sym$level,new cljs.core.PersistentArrayMap(null, 1, [cljs.core.cst$kw$mutable,true], null))], null);
}));
(cljs.core.async.impl.timers.SkipList.cljs$lang$type = true);
(cljs.core.async.impl.timers.SkipList.cljs$lang$ctorStr = "cljs.core.async.impl.timers/SkipList");
(cljs.core.async.impl.timers.SkipList.cljs$lang$ctorPrWriter = (function (this__5330__auto__,writer__5331__auto__,opt__5332__auto__){
return cljs.core._write(writer__5331__auto__,"cljs.core.async.impl.timers/SkipList");
}));
/**
* Positional factory function for cljs.core.async.impl.timers/SkipList.
*/
cljs.core.async.impl.timers.__GT_SkipList = (function cljs$core$async$impl$timers$__GT_SkipList(header,level){
return (new cljs.core.async.impl.timers.SkipList(header,level));
});
cljs.core.async.impl.timers.skip_list = (function cljs$core$async$impl$timers$skip_list(){
return (new cljs.core.async.impl.timers.SkipList(cljs.core.async.impl.timers.skip_list_node.cljs$core$IFn$_invoke$arity$1((0)),(0)));
});
cljs.core.async.impl.timers.timeouts_map = cljs.core.async.impl.timers.skip_list();
cljs.core.async.impl.timers.TIMEOUT_RESOLUTION_MS = (10);
/**
* returns a channel that will close after msecs
*/
cljs.core.async.impl.timers.timeout = (function cljs$core$async$impl$timers$timeout(msecs){
var timeout = ((new Date()).valueOf() + msecs);
var me = cljs.core.async.impl.timers.timeouts_map.ceilingEntry(timeout);
var or__5045__auto__ = (cljs.core.truth_((function (){var and__5043__auto__ = me;
if(cljs.core.truth_(and__5043__auto__)){
return (me.key < (timeout + cljs.core.async.impl.timers.TIMEOUT_RESOLUTION_MS));
} else {
return and__5043__auto__;
}
})())?me.val:null);
if(cljs.core.truth_(or__5045__auto__)){
return or__5045__auto__;
} else {
var timeout_channel = cljs.core.async.impl.channels.chan.cljs$core$IFn$_invoke$arity$1(null);
cljs.core.async.impl.timers.timeouts_map.put(timeout,timeout_channel);
cljs.core.async.impl.dispatch.queue_delay((function (){
cljs.core.async.impl.timers.timeouts_map.remove(timeout);
return cljs.core.async.impl.protocols.close_BANG_(timeout_channel);
}),msecs);
return timeout_channel;
}
});
+477
View File
@@ -0,0 +1,477 @@
goog.provide('cljs.core.constants');
goog.require('cljs.core');
cljs.core.cst$kw$response = new cljs.core.Keyword(null,"response","response",-1068424192);
cljs.core.cst$sym$form = new cljs.core.Symbol(null,"form","form",16469056,null);
cljs.core.cst$sym$tag = new cljs.core.Symbol(null,"tag","tag",350170304,null);
cljs.core.cst$kw$description = new cljs.core.Keyword(null,"description","description",-1428560544);
cljs.core.cst$sym$_AMPERSAND_ = new cljs.core.Symbol(null,"&","&",-2144855648,null);
cljs.core.cst$sym$uuid = new cljs.core.Symbol(null,"uuid","uuid",-504564192,null);
cljs.core.cst$kw$div$todo_DASH_page = new cljs.core.Keyword(null,"div.todo-page","div.todo-page",-241729984);
cljs.core.cst$kw$features = new cljs.core.Keyword(null,"features","features",-1146962336);
cljs.core.cst$sym$case_STAR_ = new cljs.core.Symbol(null,"case*","case*",-1938255072,null);
cljs.core.cst$sym$after_DASH_render = new cljs.core.Symbol(null,"after-render","after-render",-656902336,null);
cljs.core.cst$kw$ex_DASH_kind = new cljs.core.Keyword(null,"ex-kind","ex-kind",1581199296);
cljs.core.cst$sym$clauses = new cljs.core.Symbol(null,"clauses","clauses",-1199594528,null);
cljs.core.cst$kw$async = new cljs.core.Keyword(null,"async","async",1050769601);
cljs.core.cst$sym$end = new cljs.core.Symbol(null,"end","end",1372345569,null);
cljs.core.cst$sym$defrecord_STAR_ = new cljs.core.Symbol(null,"defrecord*","defrecord*",-1936366207,null);
cljs.core.cst$sym$meta8942 = new cljs.core.Symbol(null,"meta8942","meta8942",1074984321,null);
cljs.core.cst$sym$base = new cljs.core.Symbol(null,"base","base",1825810849,null);
cljs.core.cst$sym$obj = new cljs.core.Symbol(null,"obj","obj",-1672671807,null);
cljs.core.cst$kw$finally = new cljs.core.Keyword(null,"finally","finally",1589088705);
cljs.core.cst$kw$data_DASH_index = new cljs.core.Keyword(null,"data-index","data-index",1161508385);
cljs.core.cst$sym$fqn = new cljs.core.Symbol(null,"fqn","fqn",-1749334463,null);
cljs.core.cst$sym$Class = new cljs.core.Symbol(null,"Class","Class",2064526977,null);
cljs.core.cst$sym$first = new cljs.core.Symbol(null,"first","first",996428481,null);
cljs.core.cst$kw$reader_DASH_error = new cljs.core.Keyword(null,"reader-error","reader-error",1610253121);
cljs.core.cst$sym$try = new cljs.core.Symbol(null,"try","try",-1273693247,null);
cljs.core.cst$sym$change = new cljs.core.Symbol(null,"change","change",477485025,null);
cljs.core.cst$sym$has_DASH_nil_QMARK_ = new cljs.core.Symbol(null,"has-nil?","has-nil?",825886722,null);
cljs.core.cst$kw$on_DASH_set = new cljs.core.Keyword(null,"on-set","on-set",-140953470);
cljs.core.cst$kw$live_for = new cljs.core.Keyword(null,"live_for","live_for",663254210);
cljs.core.cst$kw$format = new cljs.core.Keyword(null,"format","format",-1306924766);
cljs.core.cst$sym$puts = new cljs.core.Symbol(null,"puts","puts",-1883877054,null);
cljs.core.cst$sym$meta10272 = new cljs.core.Symbol(null,"meta10272","meta10272",1295395426,null);
cljs.core.cst$sym$vf = new cljs.core.Symbol(null,"vf","vf",1319108258,null);
cljs.core.cst$sym$rear = new cljs.core.Symbol(null,"rear","rear",-900164830,null);
cljs.core.cst$sym$hierarchy = new cljs.core.Symbol(null,"hierarchy","hierarchy",587061186,null);
cljs.core.cst$sym$iter = new cljs.core.Symbol(null,"iter","iter",-1346195486,null);
cljs.core.cst$kw$_STAR_ = new cljs.core.Keyword(null,"*","*",-1294732318);
cljs.core.cst$sym$clojure$core_SLASH_list = new cljs.core.Symbol("clojure.core","list","clojure.core/list",-1119203325,null);
cljs.core.cst$kw$get = new cljs.core.Keyword(null,"get","get",1683182755);
cljs.core.cst$sym$watching = new cljs.core.Symbol(null,"watching","watching",1947648227,null);
cljs.core.cst$sym$handler = new cljs.core.Symbol(null,"handler","handler",1444934915,null);
cljs.core.cst$sym$step = new cljs.core.Symbol(null,"step","step",-1365547645,null);
cljs.core.cst$kw$fname = new cljs.core.Keyword(null,"fname","fname",1500291491);
cljs.core.cst$sym$boolean = new cljs.core.Symbol(null,"boolean","boolean",-278886877,null);
cljs.core.cst$sym$update_DASH_count = new cljs.core.Symbol(null,"update-count","update-count",-411982269,null);
cljs.core.cst$kw$somef = new cljs.core.Keyword(null,"somef","somef",-622590365);
cljs.core.cst$sym$reaction = new cljs.core.Symbol(null,"reaction","reaction",2131401315,null);
cljs.core.cst$sym$method_DASH_table = new cljs.core.Symbol(null,"method-table","method-table",-1878263165,null);
cljs.core.cst$kw$ready = new cljs.core.Keyword(null,"ready","ready",1086465795);
cljs.core.cst$sym$chunk = new cljs.core.Symbol(null,"chunk","chunk",449371907,null);
cljs.core.cst$sym$callback = new cljs.core.Symbol(null,"callback","callback",935395299,null);
cljs.core.cst$kw$matched = new cljs.core.Keyword(null,"matched","matched",-975207164);
cljs.core.cst$sym$i = new cljs.core.Symbol(null,"i","i",253690212,null);
cljs.core.cst$kw$api = new cljs.core.Keyword(null,"api","api",-899839580);
cljs.core.cst$sym$rest = new cljs.core.Symbol(null,"rest","rest",398835108,null);
cljs.core.cst$kw$original_DASH_text = new cljs.core.Keyword(null,"original-text","original-text",744448452);
cljs.core.cst$kw$namespaced_DASH_map = new cljs.core.Keyword(null,"namespaced-map","namespaced-map",1235665380);
cljs.core.cst$kw$meta = new cljs.core.Keyword(null,"meta","meta",1499536964);
cljs.core.cst$sym$p = new cljs.core.Symbol(null,"p","p",1791580836,null);
cljs.core.cst$sym$s_DASH_pos = new cljs.core.Symbol(null,"s-pos","s-pos",-540562492,null);
cljs.core.cst$kw$ul = new cljs.core.Keyword(null,"ul","ul",-1349521403);
cljs.core.cst$kw$kf = new cljs.core.Keyword(null,"kf","kf",1608087589);
cljs.core.cst$sym$rep_DASH_fn = new cljs.core.Symbol(null,"rep-fn","rep-fn",-1724891035,null);
cljs.core.cst$kw$mutes = new cljs.core.Keyword(null,"mutes","mutes",1068806309);
cljs.core.cst$kw$keywords_QMARK_ = new cljs.core.Keyword(null,"keywords?","keywords?",764949733);
cljs.core.cst$kw$dup = new cljs.core.Keyword(null,"dup","dup",556298533);
cljs.core.cst$sym$meta2240 = new cljs.core.Symbol(null,"meta2240","meta2240",-230975163,null);
cljs.core.cst$kw$solo = new cljs.core.Keyword(null,"solo","solo",-316350075);
cljs.core.cst$kw$li$message = new cljs.core.Keyword(null,"li.message","li.message",-992924155);
cljs.core.cst$kw$read = new cljs.core.Keyword(null,"read","read",1140058661);
cljs.core.cst$kw$key = new cljs.core.Keyword(null,"key","key",-1516042587);
cljs.core.cst$sym$comp = new cljs.core.Symbol(null,"comp","comp",-1462482139,null);
cljs.core.cst$sym$cljs$core_SLASH_array_DASH_map = new cljs.core.Symbol("cljs.core","array-map","cljs.core/array-map",-1519210683,null);
cljs.core.cst$sym$dispatch_DASH_fn = new cljs.core.Symbol(null,"dispatch-fn","dispatch-fn",-1401088155,null);
cljs.core.cst$kw$placeholder = new cljs.core.Keyword(null,"placeholder","placeholder",-104873083);
cljs.core.cst$sym$buffer = new cljs.core.Symbol(null,"buffer","buffer",-2037140571,null);
cljs.core.cst$kw$cljs$core$async_SLASH_nothing = new cljs.core.Keyword("cljs.core.async","nothing","cljs.core.async/nothing",-69252123);
cljs.core.cst$kw$index = new cljs.core.Keyword(null,"index","index",-1531685915);
cljs.core.cst$kw$i_SHARP_back$btn = new cljs.core.Keyword(null,"i#back.btn","i#back.btn",-1215314874);
cljs.core.cst$sym$prev_DASH_column = new cljs.core.Symbol(null,"prev-column","prev-column",324083974,null);
cljs.core.cst$kw$reader_DASH_exception = new cljs.core.Keyword(null,"reader-exception","reader-exception",-1938323098);
cljs.core.cst$kw$not_DASH_initialized = new cljs.core.Keyword(null,"not-initialized","not-initialized",-1937378906);
cljs.core.cst$kw$else = new cljs.core.Keyword(null,"else","else",-1508377146);
cljs.core.cst$sym$left = new cljs.core.Symbol(null,"left","left",1241415590,null);
cljs.core.cst$kw$li$todo_DASH_line = new cljs.core.Keyword(null,"li.todo-line","li.todo-line",-120685561);
cljs.core.cst$sym$ns_STAR_ = new cljs.core.Symbol(null,"ns*","ns*",1840949383,null);
cljs.core.cst$kw$failure = new cljs.core.Keyword(null,"failure","failure",720415879);
cljs.core.cst$kw$offset = new cljs.core.Keyword(null,"offset","offset",296498311);
cljs.core.cst$sym$path = new cljs.core.Symbol(null,"path","path",1452340359,null);
cljs.core.cst$kw$cljs$core_SLASH_none = new cljs.core.Keyword("cljs.core","none","cljs.core/none",926646439);
cljs.core.cst$sym$shift = new cljs.core.Symbol(null,"shift","shift",-1657295705,null);
cljs.core.cst$sym$cljs$core_SLASH_hash_DASH_map = new cljs.core.Symbol("cljs.core","hash-map","cljs.core/hash-map",303385767,null);
cljs.core.cst$sym$iters = new cljs.core.Symbol(null,"iters","iters",719353031,null);
cljs.core.cst$kw$derefed = new cljs.core.Keyword(null,"derefed","derefed",590684583);
cljs.core.cst$sym$meta10264 = new cljs.core.Symbol(null,"meta10264","meta10264",-212104601,null);
cljs.core.cst$sym$cljs$core_SLASH_apply = new cljs.core.Symbol("cljs.core","apply","cljs.core/apply",1757277831,null);
cljs.core.cst$kw$displayName = new cljs.core.Keyword(null,"displayName","displayName",-809144601);
cljs.core.cst$sym$args = new cljs.core.Symbol(null,"args","args",-1338879193,null);
cljs.core.cst$sym$active_QMARK_ = new cljs.core.Symbol(null,"active?","active?",2100031303,null);
cljs.core.cst$kw$span_SHARP_add_DASH_item$btn = new cljs.core.Keyword(null,"span#add-item.btn","span#add-item.btn",-776494201);
cljs.core.cst$sym$xform = new cljs.core.Symbol(null,"xform","xform",-85179481,null);
cljs.core.cst$kw$validator = new cljs.core.Keyword(null,"validator","validator",-1966190681);
cljs.core.cst$sym$finally = new cljs.core.Symbol(null,"finally","finally",-1065347064,null);
cljs.core.cst$kw$method = new cljs.core.Keyword(null,"method","method",55703592);
cljs.core.cst$sym$closed = new cljs.core.Symbol(null,"closed","closed",720856168,null);
cljs.core.cst$kw$content = new cljs.core.Keyword(null,"content","content",15833224);
cljs.core.cst$kw$raw = new cljs.core.Keyword(null,"raw","raw",1604651272);
cljs.core.cst$kw$default = new cljs.core.Keyword(null,"default","default",-1987822328);
cljs.core.cst$kw$cljsRender = new cljs.core.Keyword(null,"cljsRender","cljsRender",247449928);
cljs.core.cst$kw$finally_DASH_block = new cljs.core.Keyword(null,"finally-block","finally-block",832982472);
cljs.core.cst$sym$lists_DASH_page = new cljs.core.Symbol(null,"lists-page","lists-page",1789205992,null);
cljs.core.cst$sym$prefer_DASH_table = new cljs.core.Symbol(null,"prefer-table","prefer-table",462168584,null);
cljs.core.cst$sym$cb = new cljs.core.Symbol(null,"cb","cb",-2064487928,null);
cljs.core.cst$sym$cljs$core$async_SLASH_t_cljs$core$async10263 = new cljs.core.Symbol("cljs.core.async","t_cljs$core$async10263","cljs.core.async/t_cljs$core$async10263",-798337432,null);
cljs.core.cst$sym$loop_STAR_ = new cljs.core.Symbol(null,"loop*","loop*",615029416,null);
cljs.core.cst$sym$watches = new cljs.core.Symbol(null,"watches","watches",1367433992,null);
cljs.core.cst$kw$ns = new cljs.core.Keyword(null,"ns","ns",441598760);
cljs.core.cst$kw$symbol = new cljs.core.Keyword(null,"symbol","symbol",-1038572696);
cljs.core.cst$sym$buf_DASH_fn = new cljs.core.Symbol(null,"buf-fn","buf-fn",-1200281591,null);
cljs.core.cst$kw$name = new cljs.core.Keyword(null,"name","name",1843675177);
cljs.core.cst$sym$NaN = new cljs.core.Symbol(null,"NaN","NaN",666918153,null);
cljs.core.cst$kw$pending = new cljs.core.Keyword(null,"pending","pending",-220036727);
cljs.core.cst$sym$rdr = new cljs.core.Symbol(null,"rdr","rdr",190007785,null);
cljs.core.cst$sym$bitmap = new cljs.core.Symbol(null,"bitmap","bitmap",501334601,null);
cljs.core.cst$sym$_seq = new cljs.core.Symbol(null,"_seq","_seq",-449557847,null);
cljs.core.cst$sym$on_DASH_set = new cljs.core.Symbol(null,"on-set","on-set",1499578057,null);
cljs.core.cst$sym$nil_DASH_val = new cljs.core.Symbol(null,"nil-val","nil-val",-513933559,null);
cljs.core.cst$kw$value = new cljs.core.Keyword(null,"value","value",305978217);
cljs.core.cst$sym$solo_DASH_mode = new cljs.core.Symbol(null,"solo-mode","solo-mode",2031788074,null);
cljs.core.cst$sym$somef = new cljs.core.Symbol(null,"somef","somef",1017941162,null);
cljs.core.cst$sym$meta10267 = new cljs.core.Symbol(null,"meta10267","meta10267",90644714,null);
cljs.core.cst$kw$response_DASH_format = new cljs.core.Keyword(null,"response-format","response-format",1664465322);
cljs.core.cst$kw$status_DASH_text = new cljs.core.Keyword(null,"status-text","status-text",-1834235478);
cljs.core.cst$kw$component_DASH_did_DASH_mount = new cljs.core.Keyword(null,"component-did-mount","component-did-mount",-1126910518);
cljs.core.cst$kw$file = new cljs.core.Keyword(null,"file","file",-1269645878);
cljs.core.cst$kw$textarea$edit_DASH_item_DASH_text = new cljs.core.Keyword(null,"textarea.edit-item-text","textarea.edit-item-text",-615742998);
cljs.core.cst$kw$i_SHARP_add_DASH_item_DASH_done$btn = new cljs.core.Keyword(null,"i#add-item-done.btn","i#add-item-done.btn",-1088566806);
cljs.core.cst$sym$cljs$core_SLASH_concat = new cljs.core.Symbol("cljs.core","concat","cljs.core/concat",-1133584918,null);
cljs.core.cst$sym$v = new cljs.core.Symbol(null,"v","v",1661996586,null);
cljs.core.cst$kw$compute = new cljs.core.Keyword(null,"compute","compute",1555393130);
cljs.core.cst$sym$js = new cljs.core.Symbol(null,"js","js",-886355190,null);
cljs.core.cst$kw$readers = new cljs.core.Keyword(null,"readers","readers",-2118263030);
cljs.core.cst$kw$secretary$core_SLASH_map = new cljs.core.Keyword("secretary.core","map","secretary.core/map",-31086646);
cljs.core.cst$kw$end_DASH_column = new cljs.core.Keyword(null,"end-column","end-column",1425389514);
cljs.core.cst$sym$riter = new cljs.core.Symbol(null,"riter","riter",-237834262,null);
cljs.core.cst$sym$__hash = new cljs.core.Symbol(null,"__hash","__hash",-1328796629,null);
cljs.core.cst$sym$meta = new cljs.core.Symbol(null,"meta","meta",-1154898805,null);
cljs.core.cst$sym$_meta = new cljs.core.Symbol(null,"_meta","_meta",-1716892533,null);
cljs.core.cst$kw$aborted = new cljs.core.Keyword(null,"aborted","aborted",1775972619);
cljs.core.cst$kw$span$unchecked_DASH_count = new cljs.core.Keyword(null,"span.unchecked-count","span.unchecked-count",-408283861);
cljs.core.cst$sym$afn = new cljs.core.Symbol(null,"afn","afn",216963467,null);
cljs.core.cst$kw$processing_DASH_request = new cljs.core.Keyword(null,"processing-request","processing-request",-264947221);
cljs.core.cst$kw$params = new cljs.core.Keyword(null,"params","params",710516235);
cljs.core.cst$kw$p$warn = new cljs.core.Keyword(null,"p.warn","p.warn",-621694453);
cljs.core.cst$kw$on_DASH_blur = new cljs.core.Keyword(null,"on-blur","on-blur",814300747);
cljs.core.cst$sym$todos = new cljs.core.Symbol(null,"todos","todos",-2024126901,null);
cljs.core.cst$sym$tree = new cljs.core.Symbol(null,"tree","tree",1444219499,null);
cljs.core.cst$sym$fn = new cljs.core.Symbol(null,"fn","fn",465265323,null);
cljs.core.cst$kw$div_SHARP_loader = new cljs.core.Keyword(null,"div#loader","div#loader",418409131);
cljs.core.cst$sym$front = new cljs.core.Symbol(null,"front","front",117022539,null);
cljs.core.cst$sym$buf = new cljs.core.Symbol(null,"buf","buf",1426618187,null);
cljs.core.cst$sym$mults = new cljs.core.Symbol(null,"mults","mults",-461114485,null);
cljs.core.cst$kw$component_DASH_did_DASH_update = new cljs.core.Keyword(null,"component-did-update","component-did-update",-1468549173);
cljs.core.cst$sym$next_DASH_entry = new cljs.core.Symbol(null,"next-entry","next-entry",1091342476,null);
cljs.core.cst$kw$read_DASH_cond = new cljs.core.Keyword(null,"read-cond","read-cond",1056899244);
cljs.core.cst$kw$val = new cljs.core.Keyword(null,"val","val",128701612);
cljs.core.cst$sym$key = new cljs.core.Symbol(null,"key","key",124488940,null);
cljs.core.cst$sym$meta4886 = new cljs.core.Symbol(null,"meta4886","meta4886",-297171700,null);
cljs.core.cst$sym$_next = new cljs.core.Symbol(null,"_next","_next",101877036,null);
cljs.core.cst$sym$inst = new cljs.core.Symbol(null,"inst","inst",-2008473268,null);
cljs.core.cst$sym$fn1 = new cljs.core.Symbol(null,"fn1","fn1",895834444,null);
cljs.core.cst$kw$recur = new cljs.core.Keyword(null,"recur","recur",-437573268);
cljs.core.cst$kw$li$todo_DASH_link = new cljs.core.Keyword(null,"li.todo-link","li.todo-link",1015736716);
cljs.core.cst$kw$type = new cljs.core.Keyword(null,"type","type",1174270348);
cljs.core.cst$kw$request_DASH_received = new cljs.core.Keyword(null,"request-received","request-received",2110590540);
cljs.core.cst$sym$kf = new cljs.core.Symbol(null,"kf","kf",-1046348180,null);
cljs.core.cst$sym$omgnata$core_SLASH_lists_DASH_page = new cljs.core.Symbol("omgnata.core","lists-page","omgnata.core/lists-page",593904300,null);
cljs.core.cst$kw$catch_DASH_block = new cljs.core.Keyword(null,"catch-block","catch-block",1175212748);
cljs.core.cst$sym$root_DASH_iter = new cljs.core.Symbol(null,"root-iter","root-iter",1974672108,null);
cljs.core.cst$kw$delete = new cljs.core.Keyword(null,"delete","delete",-1768633620);
cljs.core.cst$kw$div_SHARP_list_DASH_edit_DASH_container = new cljs.core.Keyword(null,"div#list-edit-container","div#list-edit-container",500002636);
cljs.core.cst$sym$do = new cljs.core.Symbol(null,"do","do",1686842252,null);
cljs.core.cst$sym$vec = new cljs.core.Symbol(null,"vec","vec",982683596,null);
cljs.core.cst$sym$p__4883 = new cljs.core.Symbol(null,"p__4883","p__4883",2053661997,null);
cljs.core.cst$sym$add_BANG_ = new cljs.core.Symbol(null,"add!","add!",2046056845,null);
cljs.core.cst$kw$preserve = new cljs.core.Keyword(null,"preserve","preserve",1276846509);
cljs.core.cst$kw$fallback_DASH_impl = new cljs.core.Keyword(null,"fallback-impl","fallback-impl",-1501286995);
cljs.core.cst$kw$route = new cljs.core.Keyword(null,"route","route",329891309);
cljs.core.cst$kw$keyword_DASH_fn = new cljs.core.Keyword(null,"keyword-fn","keyword-fn",-64566675);
cljs.core.cst$sym$Inf = new cljs.core.Symbol(null,"Inf","Inf",647172781,null);
cljs.core.cst$kw$source = new cljs.core.Keyword(null,"source","source",-433931539);
cljs.core.cst$kw$handlers = new cljs.core.Keyword(null,"handlers","handlers",79528781);
cljs.core.cst$kw$flush_DASH_on_DASH_newline = new cljs.core.Keyword(null,"flush-on-newline","flush-on-newline",-151457939);
cljs.core.cst$kw$finished = new cljs.core.Keyword(null,"finished","finished",-1018867731);
cljs.core.cst$sym$default_DASH_dispatch_DASH_val = new cljs.core.Symbol(null,"default-dispatch-val","default-dispatch-val",-1231201266,null);
cljs.core.cst$kw$componentWillUnmount = new cljs.core.Keyword(null,"componentWillUnmount","componentWillUnmount",1573788814);
cljs.core.cst$kw$no_DASH_test = new cljs.core.Keyword(null,"no-test","no-test",-1679482642);
cljs.core.cst$kw$string = new cljs.core.Keyword(null,"string","string",-1989541586);
cljs.core.cst$sym$queue = new cljs.core.Symbol(null,"queue","queue",-1198599890,null);
cljs.core.cst$sym$_ = new cljs.core.Symbol(null,"_","_",-1201019570,null);
cljs.core.cst$kw$vector = new cljs.core.Keyword(null,"vector","vector",1902966158);
cljs.core.cst$sym$validator = new cljs.core.Symbol(null,"validator","validator",-325659154,null);
cljs.core.cst$kw$illegal_DASH_argument = new cljs.core.Keyword(null,"illegal-argument","illegal-argument",-1845493170);
cljs.core.cst$sym$letfn_STAR_ = new cljs.core.Symbol(null,"letfn*","letfn*",-110097810,null);
cljs.core.cst$kw$cljs$analyzer_SLASH_analyzed = new cljs.core.Keyword("cljs.analyzer","analyzed","cljs.analyzer/analyzed",-735094162);
cljs.core.cst$sym$meta8924 = new cljs.core.Symbol(null,"meta8924","meta8924",1531656878,null);
cljs.core.cst$sym$if = new cljs.core.Symbol(null,"if","if",1181717262,null);
cljs.core.cst$sym$readable = new cljs.core.Symbol(null,"readable","readable",2113054478,null);
cljs.core.cst$kw$parse_DASH_error = new cljs.core.Keyword(null,"parse-error","parse-error",255902478);
cljs.core.cst$sym$cljs$core_SLASH_with_DASH_meta = new cljs.core.Symbol("cljs.core","with-meta","cljs.core/with-meta",749126446,null);
cljs.core.cst$sym$finally_DASH_block = new cljs.core.Symbol(null,"finally-block","finally-block",-1821453297,null);
cljs.core.cst$sym$arr = new cljs.core.Symbol(null,"arr","arr",2115492975,null);
cljs.core.cst$sym$new = new cljs.core.Symbol(null,"new","new",-444906321,null);
cljs.core.cst$kw$on_DASH_click = new cljs.core.Keyword(null,"on-click","on-click",1632826543);
cljs.core.cst$kw$strable = new cljs.core.Keyword(null,"strable","strable",1877668047);
cljs.core.cst$kw$descendants = new cljs.core.Keyword(null,"descendants","descendants",1824886031);
cljs.core.cst$kw$allow = new cljs.core.Keyword(null,"allow","allow",-1857325745);
cljs.core.cst$sym$ns = new cljs.core.Symbol(null,"ns","ns",2082130287,null);
cljs.core.cst$kw$title = new cljs.core.Keyword(null,"title","title",636505583);
cljs.core.cst$kw$sym = new cljs.core.Keyword(null,"sym","sym",-1444860305);
cljs.core.cst$kw$prefix = new cljs.core.Keyword(null,"prefix","prefix",-265908465);
cljs.core.cst$kw$column = new cljs.core.Keyword(null,"column","column",2078222095);
cljs.core.cst$sym$pick = new cljs.core.Symbol(null,"pick","pick",1300068175,null);
cljs.core.cst$kw$headers = new cljs.core.Keyword(null,"headers","headers",-835030129);
cljs.core.cst$kw$i$checkbox$btn = new cljs.core.Keyword(null,"i.checkbox.btn","i.checkbox.btn",15892367);
cljs.core.cst$sym$completed = new cljs.core.Symbol(null,"completed","completed",1154475024,null);
cljs.core.cst$sym$forward = new cljs.core.Symbol(null,"forward","forward",1083186224,null);
cljs.core.cst$kw$div$message = new cljs.core.Keyword(null,"div.message","div.message",197515312);
cljs.core.cst$kw$shouldComponentUpdate = new cljs.core.Keyword(null,"shouldComponentUpdate","shouldComponentUpdate",1795750960);
cljs.core.cst$kw$error_DASH_handler = new cljs.core.Keyword(null,"error-handler","error-handler",-484945776);
cljs.core.cst$kw$ancestors = new cljs.core.Keyword(null,"ancestors","ancestors",-776045424);
cljs.core.cst$sym$flag = new cljs.core.Symbol(null,"flag","flag",-1565787888,null);
cljs.core.cst$kw$style = new cljs.core.Keyword(null,"style","style",-496642736);
cljs.core.cst$sym$ensure_DASH_mult = new cljs.core.Symbol(null,"ensure-mult","ensure-mult",1796584816,null);
cljs.core.cst$sym$value = new cljs.core.Symbol(null,"value","value",1946509744,null);
cljs.core.cst$kw$write = new cljs.core.Keyword(null,"write","write",-1857649168);
cljs.core.cst$sym$name = new cljs.core.Symbol(null,"name","name",-810760592,null);
cljs.core.cst$sym$meta9735 = new cljs.core.Symbol(null,"meta9735","meta9735",-1978445200,null);
cljs.core.cst$sym$map__4884 = new cljs.core.Symbol(null,"map__4884","map__4884",-1688549712,null);
cljs.core.cst$sym$n = new cljs.core.Symbol(null,"n","n",-2092305744,null);
cljs.core.cst$kw$div = new cljs.core.Keyword(null,"div","div",1057191632);
cljs.core.cst$sym$frames = new cljs.core.Symbol(null,"frames","frames",-888748272,null);
cljs.core.cst$kw$readably = new cljs.core.Keyword(null,"readably","readably",1129599760);
cljs.core.cst$kw$more_DASH_marker = new cljs.core.Keyword(null,"more-marker","more-marker",-14717935);
cljs.core.cst$kw$span$btn$handle$fa_DASH_stack = new cljs.core.Keyword(null,"span.btn.handle.fa-stack","span.btn.handle.fa-stack",-1487675343);
cljs.core.cst$sym$fields = new cljs.core.Symbol(null,"fields","fields",-291534703,null);
cljs.core.cst$sym$re = new cljs.core.Symbol(null,"re","re",1869207729,null);
cljs.core.cst$sym$scheduled_QMARK_ = new cljs.core.Symbol(null,"scheduled?","scheduled?",579986609,null);
cljs.core.cst$kw$i$btn$delete_DASH_item = new cljs.core.Keyword(null,"i.btn.delete-item","i.btn.delete-item",982327537);
cljs.core.cst$sym$method_DASH_cache = new cljs.core.Symbol(null,"method-cache","method-cache",1230193905,null);
cljs.core.cst$sym$cs = new cljs.core.Symbol(null,"cs","cs",-117024463,null);
cljs.core.cst$kw$div_SHARP_add_DASH_item_DASH_container = new cljs.core.Keyword(null,"div#add-item-container","div#add-item-container",1139529041);
cljs.core.cst$sym$dirty_QMARK_ = new cljs.core.Symbol(null,"dirty?","dirty?",-419314319,null);
cljs.core.cst$sym$orig_DASH_route = new cljs.core.Symbol(null,"orig-route","orig-route",899103121,null);
cljs.core.cst$kw$reagentRender = new cljs.core.Keyword(null,"reagentRender","reagentRender",-358306383);
cljs.core.cst$kw$filename = new cljs.core.Keyword(null,"filename","filename",-1428840783);
cljs.core.cst$sym$meta10275 = new cljs.core.Symbol(null,"meta10275","meta10275",1969594161,null);
cljs.core.cst$sym$edit = new cljs.core.Symbol(null,"edit","edit",-1302639,null);
cljs.core.cst$sym$meta3381 = new cljs.core.Symbol(null,"meta3381","meta3381",999308338,null);
cljs.core.cst$sym$params = new cljs.core.Symbol(null,"params","params",-1943919534,null);
cljs.core.cst$sym$editable_QMARK_ = new cljs.core.Symbol(null,"editable?","editable?",-164945806,null);
cljs.core.cst$sym$base_DASH_count = new cljs.core.Symbol(null,"base-count","base-count",-1180647182,null);
cljs.core.cst$sym$verbose_DASH_handler_DASH_fn = new cljs.core.Symbol(null,"verbose-handler-fn","verbose-handler-fn",547340594,null);
cljs.core.cst$kw$render = new cljs.core.Keyword(null,"render","render",-1408033454);
cljs.core.cst$kw$illegal_DASH_state = new cljs.core.Keyword(null,"illegal-state","illegal-state",-1519851182);
cljs.core.cst$sym$clojure$core_SLASH_unquote_DASH_splicing = new cljs.core.Symbol("clojure.core","unquote-splicing","clojure.core/unquote-splicing",-552003150,null);
cljs.core.cst$sym$collision_DASH_hash = new cljs.core.Symbol(null,"collision-hash","collision-hash",-35831342,null);
cljs.core.cst$sym$deftype_STAR_ = new cljs.core.Symbol(null,"deftype*","deftype*",962659890,null);
cljs.core.cst$sym$let_STAR_ = new cljs.core.Symbol(null,"let*","let*",1920721458,null);
cljs.core.cst$sym$meta8945 = new cljs.core.Symbol(null,"meta8945","meta8945",1831858866,null);
cljs.core.cst$sym$start = new cljs.core.Symbol(null,"start","start",1285322546,null);
cljs.core.cst$kw$splicing_QMARK_ = new cljs.core.Keyword(null,"splicing?","splicing?",-428596366);
cljs.core.cst$sym$sourceIter = new cljs.core.Symbol(null,"sourceIter","sourceIter",1068220306,null);
cljs.core.cst$sym$coll = new cljs.core.Symbol(null,"coll","coll",-1006698606,null);
cljs.core.cst$sym$not_DASH_native = new cljs.core.Symbol(null,"not-native","not-native",-236392494,null);
cljs.core.cst$sym$js_STAR_ = new cljs.core.Symbol(null,"js*","js*",-1134233646,null);
cljs.core.cst$kw$details = new cljs.core.Keyword(null,"details","details",1956795411);
cljs.core.cst$kw$reagent_DASH_render = new cljs.core.Keyword(null,"reagent-render","reagent-render",-985383853);
cljs.core.cst$sym$strobj = new cljs.core.Symbol(null,"strobj","strobj",1088091283,null);
cljs.core.cst$sym$todo_DASH_page = new cljs.core.Symbol(null,"todo-page","todo-page",1011891,null);
cljs.core.cst$sym$catch_DASH_block = new cljs.core.Symbol(null,"catch-block","catch-block",-1479223021,null);
cljs.core.cst$sym$omgnata$core = new cljs.core.Symbol(null,"omgnata.core","omgnata.core",-1309113965,null);
cljs.core.cst$kw$line = new cljs.core.Keyword(null,"line","line",212345235);
cljs.core.cst$kw$priority = new cljs.core.Keyword(null,"priority","priority",1431093715);
cljs.core.cst$kw$solos = new cljs.core.Keyword(null,"solos","solos",1441458643);
cljs.core.cst$sym$_rest = new cljs.core.Symbol(null,"_rest","_rest",-2100466189,null);
cljs.core.cst$sym$meta1395 = new cljs.core.Symbol(null,"meta1395","meta1395",-1131043213,null);
cljs.core.cst$kw$list = new cljs.core.Keyword(null,"list","list",765357683);
cljs.core.cst$sym$fn_STAR_ = new cljs.core.Symbol(null,"fn*","fn*",-752876845,null);
cljs.core.cst$sym$val = new cljs.core.Symbol(null,"val","val",1769233139,null);
cljs.core.cst$kw$keyword = new cljs.core.Keyword(null,"keyword","keyword",811389747);
cljs.core.cst$sym$ascending_QMARK_ = new cljs.core.Symbol(null,"ascending?","ascending?",-1938452653,null);
cljs.core.cst$sym$recur = new cljs.core.Symbol(null,"recur","recur",1202958259,null);
cljs.core.cst$sym$xf = new cljs.core.Symbol(null,"xf","xf",2042434515,null);
cljs.core.cst$sym$ci = new cljs.core.Symbol(null,"ci","ci",2049808339,null);
cljs.core.cst$kw$status = new cljs.core.Keyword(null,"status","status",-1997798413);
cljs.core.cst$kw$span_SHARP_add_DASH_list$btn = new cljs.core.Keyword(null,"span#add-list.btn","span#add-list.btn",-1477394412);
cljs.core.cst$kw$response_DASH_ready = new cljs.core.Keyword(null,"response-ready","response-ready",245208276);
cljs.core.cst$kw$print_DASH_length = new cljs.core.Keyword(null,"print-length","print-length",1931866356);
cljs.core.cst$kw$writer = new cljs.core.Keyword(null,"writer","writer",-277568236);
cljs.core.cst$kw$col = new cljs.core.Keyword(null,"col","col",-1959363084);
cljs.core.cst$kw$on_DASH_double_DASH_click = new cljs.core.Keyword(null,"on-double-click","on-double-click",1434856980);
cljs.core.cst$kw$id = new cljs.core.Keyword(null,"id","id",-1388402092);
cljs.core.cst$sym$ratom = new cljs.core.Symbol(null,"ratom","ratom",1514010260,null);
cljs.core.cst$kw$i$btn$update_DASH_item_DASH_done = new cljs.core.Keyword(null,"i.btn.update-item-done","i.btn.update-item-done",-366159180);
cljs.core.cst$kw$class = new cljs.core.Keyword(null,"class","class",-2030961996);
cljs.core.cst$sym$state = new cljs.core.Symbol(null,"state","state",-348086572,null);
cljs.core.cst$kw$ok = new cljs.core.Keyword(null,"ok","ok",967785236);
cljs.core.cst$sym$vals = new cljs.core.Symbol(null,"vals","vals",-1886377036,null);
cljs.core.cst$sym$all = new cljs.core.Symbol(null,"all","all",-1762306027,null);
cljs.core.cst$sym$clojure$core_SLASH_deref = new cljs.core.Symbol("clojure.core","deref","clojure.core/deref",188719157,null);
cljs.core.cst$kw$catch_DASH_exception = new cljs.core.Keyword(null,"catch-exception","catch-exception",-1997306795);
cljs.core.cst$kw$cljs$core_SLASH_halt = new cljs.core.Keyword("cljs.core","halt","cljs.core/halt",-1049036715);
cljs.core.cst$kw$nil = new cljs.core.Keyword(null,"nil","nil",99600501);
cljs.core.cst$sym$timestamps = new cljs.core.Symbol(null,"timestamps","timestamps",819472597,null);
cljs.core.cst$sym$cached_DASH_hierarchy = new cljs.core.Symbol(null,"cached-hierarchy","cached-hierarchy",-1085460203,null);
cljs.core.cst$sym$header = new cljs.core.Symbol(null,"header","header",1759972661,null);
cljs.core.cst$kw$auto_DASH_run = new cljs.core.Keyword(null,"auto-run","auto-run",1958400437);
cljs.core.cst$kw$reader = new cljs.core.Keyword(null,"reader","reader",169660853);
cljs.core.cst$kw$checked = new cljs.core.Keyword(null,"checked","checked",-50955819);
cljs.core.cst$sym$s = new cljs.core.Symbol(null,"s","s",-948495851,null);
cljs.core.cst$kw$cljsName = new cljs.core.Keyword(null,"cljsName","cljsName",999824949);
cljs.core.cst$kw$parents = new cljs.core.Keyword(null,"parents","parents",-2027538891);
cljs.core.cst$sym$cnt = new cljs.core.Symbol(null,"cnt","cnt",1924510325,null);
cljs.core.cst$kw$parse = new cljs.core.Keyword(null,"parse","parse",-1162164619);
cljs.core.cst$sym$_SLASH_ = new cljs.core.Symbol(null,"/","/",-1371932971,null);
cljs.core.cst$kw$initk = new cljs.core.Keyword(null,"initk","initk",-1693342987);
cljs.core.cst$sym$meta10820 = new cljs.core.Symbol(null,"meta10820","meta10820",179373909,null);
cljs.core.cst$sym$node = new cljs.core.Symbol(null,"node","node",-2073234571,null);
cljs.core.cst$kw$component_DASH_will_DASH_unmount = new cljs.core.Keyword(null,"component-will-unmount","component-will-unmount",-2058314698);
cljs.core.cst$kw$prev = new cljs.core.Keyword(null,"prev","prev",-1597069226);
cljs.core.cst$sym$sym = new cljs.core.Symbol(null,"sym","sym",195671222,null);
cljs.core.cst$sym$column = new cljs.core.Symbol(null,"column","column",-576213674,null);
cljs.core.cst$kw$url = new cljs.core.Keyword(null,"url","url",276297046);
cljs.core.cst$sym$sb = new cljs.core.Symbol(null,"sb","sb",-1249746442,null);
cljs.core.cst$kw$continue_DASH_block = new cljs.core.Keyword(null,"continue-block","continue-block",-1852047850);
cljs.core.cst$sym$clojure$core_SLASH_unquote = new cljs.core.Symbol("clojure.core","unquote","clojure.core/unquote",843087510,null);
cljs.core.cst$kw$query_DASH_params = new cljs.core.Keyword(null,"query-params","query-params",900640534);
cljs.core.cst$sym$seed = new cljs.core.Symbol(null,"seed","seed",1709144854,null);
cljs.core.cst$kw$content_DASH_type = new cljs.core.Keyword(null,"content-type","content-type",-508222634);
cljs.core.cst$sym$ch = new cljs.core.Symbol(null,"ch","ch",1085813622,null);
cljs.core.cst$sym$level = new cljs.core.Symbol(null,"level","level",-1363938217,null);
cljs.core.cst$kw$end_DASH_line = new cljs.core.Keyword(null,"end-line","end-line",1837326455);
cljs.core.cst$kw$auto_DASH_focus = new cljs.core.Keyword(null,"auto-focus","auto-focus",1250006231);
cljs.core.cst$sym$prev_DASH_seed = new cljs.core.Symbol(null,"prev-seed","prev-seed",2126381367,null);
cljs.core.cst$kw$_DASH_elem_DASH_count = new cljs.core.Keyword(null,"-elem-count","-elem-count",663797079);
cljs.core.cst$sym$buf_DASH_pos = new cljs.core.Symbol(null,"buf-pos","buf-pos",-807229033,null);
cljs.core.cst$kw$max_DASH_retries = new cljs.core.Keyword(null,"max-retries","max-retries",-1933762121);
cljs.core.cst$kw$display_DASH_name = new cljs.core.Keyword(null,"display-name","display-name",694513143);
cljs.core.cst$kw$h3$list_DASH_title = new cljs.core.Keyword(null,"h3.list-title","h3.list-title",345558615);
cljs.core.cst$sym$omgnata$core_SLASH_todo_DASH_page = new cljs.core.Symbol("omgnata.core","todo-page","omgnata.core/todo-page",-1085648265,null);
cljs.core.cst$sym$cljs$core_SLASH_vec = new cljs.core.Symbol("cljs.core","vec","cljs.core/vec",307622519,null);
cljs.core.cst$kw$post = new cljs.core.Keyword(null,"post","post",269697687);
cljs.core.cst$sym$_DASH_Inf = new cljs.core.Symbol(null,"-Inf","-Inf",-2123243689,null);
cljs.core.cst$kw$div$todo_DASH_text = new cljs.core.Keyword(null,"div.todo-text","div.todo-text",-1124244424);
cljs.core.cst$sym$str_DASH_rep_DASH_fn = new cljs.core.Symbol(null,"str-rep-fn","str-rep-fn",-1179615016,null);
cljs.core.cst$sym$_hash = new cljs.core.Symbol(null,"_hash","_hash",-2130838312,null);
cljs.core.cst$sym$filename = new cljs.core.Symbol(null,"filename","filename",211690744,null);
cljs.core.cst$kw$on_DASH_dispose = new cljs.core.Keyword(null,"on-dispose","on-dispose",2105306360);
cljs.core.cst$kw$action = new cljs.core.Keyword(null,"action","action",-811238024);
cljs.core.cst$sym$calc_DASH_state = new cljs.core.Symbol(null,"calc-state","calc-state",-349968968,null);
cljs.core.cst$sym$cljs$core_SLASH_sequence = new cljs.core.Symbol("cljs.core","sequence","cljs.core/sequence",1908459032,null);
cljs.core.cst$kw$pause = new cljs.core.Keyword(null,"pause","pause",-2095325672);
cljs.core.cst$kw$error = new cljs.core.Keyword(null,"error","error",-978969032);
cljs.core.cst$kw$regex = new cljs.core.Keyword(null,"regex","regex",939488856);
cljs.core.cst$kw$componentFunction = new cljs.core.Keyword(null,"componentFunction","componentFunction",825866104);
cljs.core.cst$sym$topic_DASH_fn = new cljs.core.Symbol(null,"topic-fn","topic-fn",-862449736,null);
cljs.core.cst$kw$i_SHARP_clear_DASH_completed$btn = new cljs.core.Keyword(null,"i#clear-completed.btn","i#clear-completed.btn",2100368344);
cljs.core.cst$sym$head = new cljs.core.Symbol(null,"head","head",869147608,null);
cljs.core.cst$kw$exception = new cljs.core.Keyword(null,"exception","exception",-335277064);
cljs.core.cst$sym$keys = new cljs.core.Symbol(null,"keys","keys",-1586012071,null);
cljs.core.cst$sym$meta5714 = new cljs.core.Symbol(null,"meta5714","meta5714",269087833,null);
cljs.core.cst$sym$vec__10816 = new cljs.core.Symbol(null,"vec__10816","vec__10816",-1184809767,null);
cljs.core.cst$sym$set_BANG_ = new cljs.core.Symbol(null,"set!","set!",250714521,null);
cljs.core.cst$kw$unsupported_DASH_operation = new cljs.core.Keyword(null,"unsupported-operation","unsupported-operation",1890540953);
cljs.core.cst$sym$splicing_QMARK_ = new cljs.core.Symbol(null,"splicing?","splicing?",1211935161,null);
cljs.core.cst$kw$uri = new cljs.core.Keyword(null,"uri","uri",-774711847);
cljs.core.cst$kw$form = new cljs.core.Keyword(null,"form","form",-1624062471);
cljs.core.cst$kw$tag = new cljs.core.Keyword(null,"tag","tag",-1290361223);
cljs.core.cst$sym$tree_DASH_map = new cljs.core.Symbol(null,"tree-map","tree-map",1373073049,null);
cljs.core.cst$sym$meta9433 = new cljs.core.Symbol(null,"meta9433","meta9433",-1569560807,null);
cljs.core.cst$kw$input = new cljs.core.Keyword(null,"input","input",556931961);
cljs.core.cst$kw$secretary$core_SLASH_sequential = new cljs.core.Keyword("secretary.core","sequential","secretary.core/sequential",-347187207);
cljs.core.cst$sym$_DOT_ = new cljs.core.Symbol(null,".",".",1975675962,null);
cljs.core.cst$sym$var = new cljs.core.Symbol(null,"var","var",870848730,null);
cljs.core.cst$kw$mutable = new cljs.core.Keyword(null,"mutable","mutable",875778266);
cljs.core.cst$kw$json = new cljs.core.Keyword(null,"json","json",1279968570);
cljs.core.cst$sym$tag_DASH_fn = new cljs.core.Symbol(null,"tag-fn","tag-fn",242055482,null);
cljs.core.cst$sym$quote = new cljs.core.Symbol(null,"quote","quote",1377916282,null);
cljs.core.cst$kw$set = new cljs.core.Keyword(null,"set","set",304602554);
cljs.core.cst$kw$timeout = new cljs.core.Keyword(null,"timeout","timeout",-318625318);
cljs.core.cst$sym$line_DASH_start_QMARK_ = new cljs.core.Symbol(null,"line-start?","line-start?",1357012474,null);
cljs.core.cst$sym$root = new cljs.core.Symbol(null,"root","root",1191874074,null);
cljs.core.cst$sym$dirty_DASH_takes = new cljs.core.Symbol(null,"dirty-takes","dirty-takes",575642138,null);
cljs.core.cst$sym$multi = new cljs.core.Symbol(null,"multi","multi",1450238522,null);
cljs.core.cst$sym$str = new cljs.core.Symbol(null,"str","str",-1564826950,null);
cljs.core.cst$sym$next = new cljs.core.Symbol(null,"next","next",1522830042,null);
cljs.core.cst$kw$i$delete_DASH_list$btn = new cljs.core.Keyword(null,"i.delete-list.btn","i.delete-list.btn",-1371286758);
cljs.core.cst$sym$nodes = new cljs.core.Symbol(null,"nodes","nodes",-459054278,null);
cljs.core.cst$sym$seen = new cljs.core.Symbol(null,"seen","seen",1121531738,null);
cljs.core.cst$sym$hash_DASH_map = new cljs.core.Symbol(null,"hash-map","hash-map",-439030950,null);
cljs.core.cst$kw$arglists = new cljs.core.Keyword(null,"arglists","arglists",1661989754);
cljs.core.cst$sym$line = new cljs.core.Symbol(null,"line","line",1852876762,null);
cljs.core.cst$sym$out = new cljs.core.Symbol(null,"out","out",729986010,null);
cljs.core.cst$kw$vf = new cljs.core.Keyword(null,"vf","vf",-321423269);
cljs.core.cst$kw$on_DASH_change = new cljs.core.Keyword(null,"on-change","on-change",-732046149);
cljs.core.cst$sym$p__2237 = new cljs.core.Symbol(null,"p__2237","p__2237",1307436219,null);
cljs.core.cst$kw$eof = new cljs.core.Keyword(null,"eof","eof",-489063237);
cljs.core.cst$kw$hierarchy = new cljs.core.Keyword(null,"hierarchy","hierarchy",-1053470341);
cljs.core.cst$sym$catch = new cljs.core.Symbol(null,"catch","catch",-1616370245,null);
cljs.core.cst$kw$timestamp = new cljs.core.Keyword(null,"timestamp","timestamp",579478971);
cljs.core.cst$kw$on_DASH_key_DASH_down = new cljs.core.Keyword(null,"on-key-down","on-key-down",-1374733765);
cljs.core.cst$kw$connection_DASH_established = new cljs.core.Keyword(null,"connection-established","connection-established",-1403749733);
cljs.core.cst$sym$s_DASH_len = new cljs.core.Symbol(null,"s-len","s-len",1869978331,null);
cljs.core.cst$kw$alt_DASH_impl = new cljs.core.Keyword(null,"alt-impl","alt-impl",670969595);
cljs.core.cst$sym$ext_DASH_map_DASH_iter = new cljs.core.Symbol(null,"ext-map-iter","ext-map-iter",-1215982757,null);
cljs.core.cst$sym$tail = new cljs.core.Symbol(null,"tail","tail",494507963,null);
cljs.core.cst$kw$doc = new cljs.core.Keyword(null,"doc","doc",1913296891);
cljs.core.cst$sym$file_DASH_name = new cljs.core.Symbol(null,"file-name","file-name",-13685732,null);
cljs.core.cst$sym$record = new cljs.core.Symbol(null,"record","record",861424668,null);
cljs.core.cst$sym$changed = new cljs.core.Symbol(null,"changed","changed",-2083710852,null);
cljs.core.cst$sym$mseq = new cljs.core.Symbol(null,"mseq","mseq",1602647196,null);
cljs.core.cst$sym$count = new cljs.core.Symbol(null,"count","count",-514511684,null);
cljs.core.cst$sym$dirty_DASH_puts = new cljs.core.Symbol(null,"dirty-puts","dirty-puts",57041148,null);
cljs.core.cst$sym$initk = new cljs.core.Symbol(null,"initk","initk",-52811460,null);
cljs.core.cst$sym$solo_DASH_modes = new cljs.core.Symbol(null,"solo-modes","solo-modes",882180540,null);
cljs.core.cst$sym$catch_DASH_exception = new cljs.core.Symbol(null,"catch-exception","catch-exception",-356775268,null);
cljs.core.cst$kw$handler = new cljs.core.Keyword(null,"handler","handler",-195596612);
cljs.core.cst$kw$keywordize_DASH_keys = new cljs.core.Keyword(null,"keywordize-keys","keywordize-keys",1310784252);
cljs.core.cst$sym$takes = new cljs.core.Symbol(null,"takes","takes",298247964,null);
cljs.core.cst$sym$current = new cljs.core.Symbol(null,"current","current",552492924,null);
cljs.core.cst$sym$off = new cljs.core.Symbol(null,"off","off",-2047994980,null);
cljs.core.cst$kw$current_DASH_page = new cljs.core.Keyword(null,"current-page","current-page",-101294180);
cljs.core.cst$kw$textarea$add_DASH_item_DASH_text = new cljs.core.Keyword(null,"textarea.add-item-text","textarea.add-item-text",1628747740);
cljs.core.cst$sym$auto_DASH_run = new cljs.core.Symbol(null,"auto-run","auto-run",-696035332,null);
cljs.core.cst$sym$length = new cljs.core.Symbol(null,"length","length",-2065447907,null);
cljs.core.cst$sym$continue_DASH_block = new cljs.core.Symbol(null,"continue-block","continue-block",-211516323,null);
cljs.core.cst$sym$stack = new cljs.core.Symbol(null,"stack","stack",847125597,null);
cljs.core.cst$kw$p = new cljs.core.Keyword(null,"p","p",151049309);
cljs.core.cst$sym$cljs$core_SLASH_hash_DASH_set = new cljs.core.Symbol("cljs.core","hash-set","cljs.core/hash-set",1130426749,null);
cljs.core.cst$sym$transient_DASH_map = new cljs.core.Symbol(null,"transient-map","transient-map",351764893,null);
cljs.core.cst$kw$character = new cljs.core.Keyword(null,"character","character",380652989);
cljs.core.cst$kw$map = new cljs.core.Keyword(null,"map","map",1371690461);
cljs.core.cst$sym$cljs$core_SLASH_list = new cljs.core.Symbol("cljs.core","list","cljs.core/list",-1331406371,null);
cljs.core.cst$kw$eofthrow = new cljs.core.Keyword(null,"eofthrow","eofthrow",-334166531);
cljs.core.cst$sym$map__2238 = new cljs.core.Symbol(null,"map__2238","map__2238",-1136596483,null);
cljs.core.cst$kw$with_DASH_credentials = new cljs.core.Keyword(null,"with-credentials","with-credentials",-1163127235);
cljs.core.cst$sym$prev = new cljs.core.Symbol(null,"prev","prev",43462301,null);
cljs.core.cst$sym$len = new cljs.core.Symbol(null,"len","len",-1230778691,null);
cljs.core.cst$sym$meta8785 = new cljs.core.Symbol(null,"meta8785","meta8785",1337781949,null);
cljs.core.cst$kw$componentWillMount = new cljs.core.Keyword(null,"componentWillMount","componentWillMount",-285327619);
cljs.core.cst$kw$i = new cljs.core.Keyword(null,"i","i",-1386841315);
cljs.core.cst$kw$test = new cljs.core.Keyword(null,"test","test",577538877);
cljs.core.cst$kw$span$edit_DASH_mode = new cljs.core.Keyword(null,"span.edit-mode","span.edit-mode",-1495820483);
cljs.core.cst$sym$right = new cljs.core.Symbol(null,"right","right",1187949694,null);
cljs.core.cst$sym$buf_DASH_len = new cljs.core.Symbol(null,"buf-len","buf-len",404510846,null);
cljs.core.cst$kw$runtime_DASH_exception = new cljs.core.Keyword(null,"runtime-exception","runtime-exception",-1495664514);
cljs.core.cst$sym$meta5887 = new cljs.core.Symbol(null,"meta5887","meta5887",314048670,null);
cljs.core.cst$sym$throw = new cljs.core.Symbol(null,"throw","throw",595905694,null);
cljs.core.cst$kw$none = new cljs.core.Keyword(null,"none","none",1333468478);
cljs.core.cst$kw$buffer = new cljs.core.Keyword(null,"buffer","buffer",617295198);
cljs.core.cst$kw$poller_DASH_time = new cljs.core.Keyword(null,"poller-time","poller-time",364073438);
cljs.core.cst$sym$fseq = new cljs.core.Symbol(null,"fseq","fseq",-1466412450,null);
cljs.core.cst$sym$meta9892 = new cljs.core.Symbol(null,"meta9892","meta9892",483024702,null);
cljs.core.cst$kw$mute = new cljs.core.Keyword(null,"mute","mute",1151223646);
cljs.core.cst$sym$chunk_DASH_next = new cljs.core.Symbol(null,"chunk-next","chunk-next",-547810434,null);
cljs.core.cst$sym$attrs = new cljs.core.Symbol(null,"attrs","attrs",-450137186,null);
cljs.core.cst$kw$cljs$core_SLASH_not_DASH_found = new cljs.core.Keyword("cljs.core","not-found","cljs.core/not-found",-1572889185);
cljs.core.cst$sym$more = new cljs.core.Symbol(null,"more","more",-418290273,null);
cljs.core.cst$sym$def = new cljs.core.Symbol(null,"def","def",597100991,null);
cljs.core.cst$kw$span = new cljs.core.Keyword(null,"span","span",1394872991);
cljs.core.cst$kw$reads = new cljs.core.Keyword(null,"reads","reads",-1215067361);
cljs.core.cst$sym$on_DASH_dispose = new cljs.core.Symbol(null,"on-dispose","on-dispose",-549129409,null);
cljs.core.cst$sym$f = new cljs.core.Symbol(null,"f","f",43394975,null);
cljs.core.cst$sym$next_DASH_iter = new cljs.core.Symbol(null,"next-iter","next-iter",1526626239,null);