]> hydra-www.ietfng.org Git - dyna2/commitdiff
fixed force-directed layout.
authorTim Vieira <tim.f.vieira@gmail.com>
Wed, 10 Jul 2013 02:51:32 +0000 (22:51 -0400)
committerTim Vieira <tim.f.vieira@gmail.com>
Wed, 10 Jul 2013 02:51:32 +0000 (22:51 -0400)
examples/force.dyna
src/Dyna/Backend/Python/interpreter.py
src/Dyna/Backend/Python/post/trace.py
test/repl/alist.dynadoc

index 2872fa772ef3ee1f72b3d48803880b32c6c4a18c..f1845bb24c16d81da401619c661047c2a9636446 100644 (file)
@@ -29,17 +29,17 @@ x(U,T) += a * forceX(U,T-1).
 y(U,T) += a * forceY(U,T-1).
 
 % make graph symmetric.
-edge(A,B) := 1 for edge(B,A).
+edge(A,B) := edge(B,A).
 
 % collect nodes.
-node(U) := true for edge(U,_).
-node(U) := true for edge(_,U).
+node(U) :- true for _ is edge(U,_).
+node(U) :- true for _ is edge(_,U).
 
 % pack x and y into a tuple
 pos(U,T) := tuple(x(U, T), y(U, T)).
 
 % visualization
-frame(T, &text(Name, pos(Name, T))) := true for _ is node(Name).
+frame(T, &text(Name, pos(Name, T))) := true for node(Name).
 frame(T, &line(pos(U, T), pos(V, T))) := true for _ is edge(U,V).
 
 % declare some edges
index 7f65a2c06b5d180cc3bebbfbefeea797484de9a0..4a4c5642e195c4df8016d7785a7ff3d04154da01 100644 (file)
@@ -4,46 +4,12 @@
 TODO
 ====
 
- - More info in crash handler. (stack trace, repl transcript, cmd-line args,
-   version control info, and dyna source is enough)
-
  - dyna syntax which just gets passed to the backend:
 
-   - running repl commands, loaders, post-procesors
-
-   - hook for python imports? or maybe an arbirary preamble/epilogue.
-
-     :- python "from bar import foo, baz"
-
-   - sheebang?
-
- - vbench: a script which tracks performace over time (= git commits).
-
- - profiler workflow
-
-   kcachegrind
-     $ (PYTHONPATH=src/Dyna/Backend/Python/ pycachegrind src/Dyna/Backend/Python/interpreter.py examples/papa.dyna)
-
-   cProfile + snakeviz
-     $ python -m cProfile -o prof src/Dyna/Backend/Python/interpreter.py examples/force.dyna >/dev/null && snakeviz prof
-
- - unit tests and code coverage.
-
- - doc tests for Dyna code.
-
  - Use Dyna do some more work! think about using Dyna to maintain rules, update
    handlers, and indices (as Jason points out indices are just memoized
    queries).
 
- - Subscriptions:
-   - TODO: users are automatically be subscribed to errors.
-   - everything
-   - functor
-   - ignore variable
-   - show diffs
-
- - TODO: True and 1 are equivalent. This sometimes leads to strange behavior.
-
 
 FASTER
 ======
index 5e8504feeb3fe427ecb9a56d0abfb96d261dc246..ed72d2f33e05b844a8399ec984982e12afa9a361 100644 (file)
@@ -178,8 +178,8 @@ class Crux(object):
             fn_args = [self.get_function(y) for y in x.body]
 
             # infix
-            if (not label.isalpha() and not label.startswith('&') and len(fn_args) == 2) \
-                    or label in ('in', 'and', 'or'):
+            if (not label[0].isalpha() and label[0] not in ('$','&') and len(fn_args) == 2) \
+                    or label in ('in', 'and', 'or', 'with_key', '->', 'is'):
                 [a,b] = fn_args
                 return '(%s %s %s)' % (a, label, b)
             return '%s(%s)' % (label, ', '.join(fn_args))
index 832a2460c9973b39d7869307aa90b9b5c26b7de5..17444504620aa3b25fa2bdf177f4b75ff4b17757 100644 (file)
@@ -37,4 +37,4 @@ No results.
 
 > query findall(3, set(3, "three", a))
 
-findall(3, set(3, "three", a)) = ["three", "c", "d"].
\ No newline at end of file
+findall(3, set(3, "three", a)) = ["three", "c", "d"].