Skip to content

Commit

Permalink
fix head &tel atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaminsk committed Feb 26, 2019
1 parent 980bf22 commit aef864f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions telingo/tests/telingo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ def test_head(self):
, ['a(2)', 'c(0)', 'c(1)', 'c(2)']
])
self.assertEqual(solve("&tel { a ;> b ;> c }.", always=False), [['a(0)', 'b(1)', 'c(2)']])
self.assertEqual(solve("&tel { a(1) ;> b(2) ;> c(3) }.", always=False), [['a(1,0)', 'b(2,1)', 'c(3,2)']])
self.assertEqual(solve("&tel { a(X) ;> b(X) ;> c(X) } :- X=(1;2).", always=False), [['a(1,0)', 'a(2,0)', 'b(1,1)', 'b(2,1)', 'c(1,2)', 'c(2,2)']])
self.assertEqual(solve("&tel { a ;>: b ;>: c }.", always=False, imin=3), [['a(0)'], ['a(0)', 'b(1)'], ['a(0)', 'b(1)', 'c(2)']])
self.assertEqual(solve("&tel { >* (&final | a) }. &tel { >* b }.", always=False, imin=3),
[ ['a(0)', 'a(1)', 'b(0)', 'b(1)', 'b(2)']
Expand Down
2 changes: 1 addition & 1 deletion telingo/theory/head.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FormulaToStr(_tf.Transformer):
Converts head formuals to string.
"""
def visit_TelAtom(self, x):
args = "" if len(x.arguments) == 0 else "({})".format(",".join(map(self, x.arguments)))
args = "" if len(x.arguments) == 0 else "({})".format(",".join(map(str, x.arguments)))
sign = "" if x.positive else "-"
return "{}{}{}".format(sign, x.name, args)

Expand Down

0 comments on commit aef864f

Please sign in to comment.