catch errors when retracting rules.
cabal build
test tests: build
- ( dist/build/dyna-selftests/dyna-selftests ; python run-doctests.py )
+ ( dist/build/dyna-selftests/dyna-selftests ; ./run-doctests.py )
# cabal test
# Compilation takes a while; for faster iteration while developing,
+#!/usr/bin/env python
from path import path
from cStringIO import StringIO
xs.remove(u)
assert u not in xs, 'Several occurrences of u in xs'
# run initializer in delete mode
- rule.init(emit=self.delete_emit)
+ try:
+ rule.init(emit=self.delete_emit)
+ except (TypeError, ZeroDivisionError):
+ pass
else:
assert rule.query is not None
# remove query handler
import re as _re
from utils import get_module
-available = 'trace', 'dump_solution', 'draw_circuit', 'graph', 'save'
+available = 'trace', 'dump_solution', 'draw_circuit', 'graph', 'save', 'draw'
def run(interp, line):
Term.__init__(self, 'nil/0', ())
self.aggregator = NoAggregator
self.aslist = []
+
def __repr__(self):
return '[]'
- def __iter__(self):
- for a in self.aslist:
- if not isinstance(a, Term):
- yield a, (None,), a
- else:
- yield a, (None,), a
+
def __contains__(self, x):
return False
+ def like_chart(self):
+ return iter([])
+
+ def __iter__(self):
+ return iter([])
+
+ def __eq__(self, other):
+ try:
+ return self.aslist == other.aslist
+ except AttributeError:
+ return False
+
+
Nil = _Nil()
(ROOT (S (NP Papa) (VP (Modal would) (VP (V have) (VP (V (V eat) -ed) (NP (Det his) (N (N sandwich) -s)))))) .)
(ROOT (S (NP (Det every) (N sandwich)) (VP (V was) (VP (V (V go) -ing) (VP (V to (V have)) (VP (V been) (Adj delicious)))))) .)
(ROOT (S (NP (NP (Det the) (N (Adj (Adj fine) and (Adj blue)) (N woman))) and (NP (Det every) (N man))) (VP (VP (Modal must) (VP (V have) (VP (VP (V (V eat) -ed) (NP (Det two) (N (N sandwich) -s))) and (VP (V (V sleep) -ed))))) (PP (P on) (NP (Det the) (N floor))))) .)
-(a b c d)
+(ROOT (A a) (B b) (C c) (D d))