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
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
======
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))
> 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"].