]> hydra-www.ietfng.org Git - dyna2/commitdiff
minor cleanup.
authorTim Vieira <tim.f.vieira@gmail.com>
Mon, 1 Jul 2013 19:47:37 +0000 (15:47 -0400)
committerTim Vieira <tim.f.vieira@gmail.com>
Mon, 1 Jul 2013 19:47:37 +0000 (15:47 -0400)
src/Dyna/Backend/Python/post/draw_circuit.py
src/Dyna/Backend/Python/post/trace.py
src/Dyna/Backend/Python/repl.py

index b01a5e78c6e7c1b848a8bb09515b586325fcc683..add8c478e2e4da7f844470e6da4b75282d7bda3b 100644 (file)
@@ -5,6 +5,7 @@ from debug import Hypergraph
 from cStringIO import StringIO
 from utils import lexer, subst
 
+
 def circuit(edges):
     # create hypergraph object
     g = Hypergraph()
index 58c2d487050961c0bb6661a95f3143436d37d20b..dbdb5bc0cae860eebce6986ac6c95781abcb3b4a 100644 (file)
@@ -1,22 +1,19 @@
 # -*- coding: utf-8 -*-
-"""
-Examine solution as an outline of computation.
-
-TODO: shared substructure.
-
-"""
 
 import re
-from utils import yellow, green, cyan, red, _repr, drepr
-import debug, defn
+from collections import defaultdict
 
+import debug, defn
 from draw_circuit import infer_edges
-from collections import defaultdict
+from utils import yellow, green, cyan, red, _repr
 
 
 class trace(object):
     """
-    Examine solution as an outline of computation.
+    Examine solution as an outline of computation. Essentially it computes
+    `trace` for every term in the current solution.
+
+    See `help trace` for more information on `trace`.
     """
 
     def __init__(self, interp):
index c3cd441abb8ab7caaf5c12b6dbdd9de69abb586f..fccbf9e3c4a2b667c8ebaa45fa76e233712a20d6 100644 (file)
@@ -422,7 +422,6 @@ class REPL(cmd.Cmd, object):
             > b :- c.
             > c.
 
-
         In our solution we see that `a` is true.
 
             > sol
@@ -481,7 +480,7 @@ class REPL(cmd.Cmd, object):
         The way trace lets you know that it has omitted something is with a
         message `item: shared structure see above` or `item: *cycle*`.
 
-          > trace bar(10,10)
+          > trace bar(10, 10)
 
           bar(10,10) = 220
           |
@@ -495,11 +494,17 @@ class REPL(cmd.Cmd, object):
           │
           │        foo(X=10) = (X=10 + 1)=11.
           │
+          │
           └─ += 110
 
              bar(A=10, B=10) += (A=10 * foo(B=10)=11)=110.
              |
-             └─ foo(10): shared structure see above
+             └─ foo(10) = 11
+                |
+                └─ continue as before (shared structure)
+
+
+        Now, let's have a look at the geometric series, `a`.
 
           > trace a
 
@@ -508,11 +513,14 @@ class REPL(cmd.Cmd, object):
           ├─ += 1
           │
           │  a += 1.
+          │
           └─ += 1.0
 
              a += (a=2.0 / 2)=1.0.
              |
-             └─ a: *cycle*
+             └─ a = 2.0
+                |
+                └─ continue as before (cyclic structure, will continue forever)
 
         """