Commits

Karsten Schmidt committed cb046b1

updating comments & readme

  • Participants
  • Parent commits 76ff5ee

Comments (0)

Files changed (3)

File README

-# Estuary
-
-Easy construction of dataflow graphs using standard Clojure agents.
-
-## Usage
-
-{{{
-(defnode a `set-value {:value 0})
-(defnode b `set-value {:value 0})
-(defaccu c `set-and-accumulate 2)
-(add-target a `c :in0)
-(add-target b `c :in1)
-(send-off a set-value 23)
-(send-off b set-value 42)
-@c ; value = 65
-}}}
-
-## License
-
-Copyright (C) 2011 Karsten Schmidt
-
-Distributed under the Eclipse Public License, the same as Clojure.
+# Estuary
+
+Easy construction of dataflow graphs using standard Clojure agents.
+
+## Usage
+
+  (ns user
+    (:use [estuary.core]))
+  
+  (defgraph g)
+  (defnode g a `set-value {:value 0})
+  (defnode g b `set-value {:value 0})
+  (defaccu g c `set-and-accumulate 2)
+  (conn! a c :in0)
+  (conn! b c :in1)
+  (send-off a set-value 23)
+  (send-off b set-value 42)
+  (Thread/sleep 100)
+  (is (= 65 (:value @c))))
+
+## License
+
+Copyright (C) 2011 Karsten Schmidt
+
+Distributed under the Eclipse Public License, the same as Clojure.

File src/estuary/core.clj

       newstate)))
 
 (defn get-node
-  "Returns the node with the given UUID."
+  "Returns the graph node with the given UUID."
   [graph uuid]
   (get (:nodes @graph) uuid))
 
        (swap! ~graph (fn[g# n#] (assoc g# :nodes (assoc (:nodes g#) (:id @n#) n#))) a#) a#)))
 
 (defmacro defaccu
-  "Similar to defnode. Creates a node with multiple input terminals."
+  "Similar to defnode. Creates a node with multiple input terminals (all of them set to 0)."
   [g id func numinputs]
   `(defnode ~g ~id ~func
      (let [state#
     (json/generate-string nodes)))
 
 (defn- prepare-targets
-  "Reconnects all agents in the given graph. Used by deserialize-graph."
+  "Reconnects all agents in the given raw deserialized graph. Used by deserialize-graph."
   [graph]
   (doseq [node (:nodes @graph)]
     (let [targets (map (fn[t] (assoc t :agent (get (:nodes @graph) (:id t)) :port (keyword (:port t)))) (:targets @(val node)))