"""
-#from debug import ultraTB2; ultraTB2.enable()
+from debug import ultraTB2; ultraTB2.enable()
#from debug import saverr; saverr.enable(editor=True)
import os, sys, math, operator
`functor_arity`. Returns arguments of term as a arity-tuple of intern idxs and
constants.
"""
- if not isinstance(x, tuple):
- return None
+ assert isinstance(x, tuple)
(fa, idx) = x
- if fa != fn:
- return None
+ assert fa == fn
return chart[fn].data[idx][:-1] # minus val
if was == now:
print ' unchanged'
- return
+ continue
chart[fn].data[idx][-1] = now
def delete(item, val):
- # XXX: very ugly handling of deletion
+ # XXX: very ugly handling of deletion by global variable; should probably
+ # target only handler at a time, because this will get called more times
+ # than it should.
global _delete
_delete = True
update_dispatcher(item, val)
for xxx in initializer.handlers:
xxx()
-run_agenda()
+def run():
+ try:
+ run_agenda()
+ except KeyboardInterrupt:
+ pass
+ finally:
+ dump_charts()
-dump_charts()
+run()
<> "peel" <> (parens $ fa f vs <> comma <> pretty id)
)
- `above` "except TypeError: continue" -- you'll get a "TypeError: 'NoneType' is not iterable."
+ `above` "except (TypeError, AssertionError): continue" -- you'll get a "TypeError: 'NoneType' is not iterable."
pdope (OPBuild v vs f) = pretty v <+> equals
fa f a = dquotes $ pretty f <> "/" <> (text $ show $ length a)
-- this comes up because can't assign to ()
-tupledOrUnderscore vs = if length vs > 0 then tupled (map pretty vs) else text "_"
+tupledOrUnderscore vs = if length vs > 0 then parens ((sepBy "," $ map pretty vs) <> ",") else text "_"
pslice vs = brackets $
sepBy "," (map (\x -> case x of (MF v) -> ":" ; (MB v) -> pretty v) vs)