(cell)
(cell content)
(cell content opts)
creates a propogation cell
(def cell-a (cell)) @cell-a => :hara.concurrent.propagate/nothing
(def cell-b (cell "Hello")) @cell-b => "Hello"
(cell-b "World") ;; invoking sets the state of the cell @cell-b => "World"
creates a propogation cell (def cell-a (cell)) @cell-a => :hara.concurrent.propagate/nothing (def cell-b (cell "Hello")) @cell-b => "Hello" (cell-b "World") ;; invoking sets the state of the cell @cell-b => "World"
(cell-state {:keys [label content ref-fn]})
prepares the state of the cell
(cell-state {:label "a" :content "hello" :ref-fn atom}) => (just {:label "a" :content clojure.lang.Atom :propagators clojure.lang.Atom})
prepares the state of the cell (cell-state {:label "a" :content "hello" :ref-fn atom}) => (just {:label "a" :content clojure.lang.Atom :propagators clojure.lang.Atom})
(deregister-propagator cell pg)
(notify-propagators cell)
(register-propagator cell pg)
(format-cells {:keys [label] :as cell})
styles the cells so they become easier to read
styles the cells so they become easier to read
(propagate pg)
(link sources sink)
(link sources sink tf)
(link sources sink tf {:keys [label tdamp concurrent] :as options})
creates a propogation link between a set of input cells and an output cell
(def in-a (cell 1)) (def in-b (cell 2)) (def inter (cell)) (def in-c (cell 3)) (def out (cell))
(link [in-a in-b] inter +) (link [inter in-c] out +)
(in-a 10) @inter => 12 @out => 15
(in-b 100) @inter => 110 @out => 113
(in-c 1000) @inter => 110 @out => 1110
creates a propogation link between a set of input cells and an output cell (def in-a (cell 1)) (def in-b (cell 2)) (def inter (cell)) (def in-c (cell 3)) (def out (cell)) (link [in-a in-b] inter +) (link [inter in-c] out +) (in-a 10) @inter => 12 @out => 15 (in-b 100) @inter => 110 @out => 113 (in-c 1000) @inter => 110 @out => 1110
(nothing? x)
checks if the value is nothing
(nothing? nil) => false
(nothing? :hara.concurrent.propagate/nothing) => true
checks if the value is nothing (nothing? nil) => false (nothing? :hara.concurrent.propagate/nothing) => true
(propagation-transfer in-vals {:keys [tf tdamp out-cell]})
propagates values to the out-cells according to transfer function
(def out-cell (cell))
(propagation-transfer [1 2 3] {:tf + :tdamp = :out-cell out-cell})
@out-cell => 6
propagates values to the out-cells according to transfer function (def out-cell (cell)) (propagation-transfer [1 2 3] {:tf + :tdamp = :out-cell out-cell}) @out-cell => 6
(propagator label)
(propagator label {:keys [in-cells out-cell tf tdamp concurrent] :as opts})
creates a propagator with a given label
(propagator "a" {:in-cells [(atom 1)] :out-cell [(atom nil)]})
creates a propagator with a given label (propagator "a" {:in-cells [(atom 1)] :out-cell [(atom nil)]})
(propagator-state {:keys [label in-cells out-cell tf tdamp concurrent]})
prepares the state of the propagator
prepares the state of the propagator
(straight-through & [x])
passes the first input through
(straight-through 1) => 1
(straight-through 1 2 3) => 1
passes the first input through (straight-through 1) => 1 (straight-through 1 2 3) => 1
(unlink pg)
removes the propagation link between a set of cells
(def in-a (cell 1)) (def out (cell))
(def lk (link [in-a] out)) (in-a 10) @out => 10
(unlink lk) (in-a 100) @in-a 100 @out => 10
removes the propagation link between a set of cells (def in-a (cell 1)) (def out (cell)) (def lk (link [in-a] out)) (in-a 10) @out => 10 (unlink lk) (in-a 100) @in-a 100 @out => 10
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close