Skip to content

Commit

Permalink
Add arity predicate access
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasZahradnik committed Apr 7, 2021
1 parent 373b64b commit 502cb0e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions neuralogic/model/atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ def __neg__(self) -> "BaseAtom":
def __invert__(self) -> "BaseAtom":
return BaseAtom(self.predicate, self.terms, not self.negated)

def __truediv__(self, other):
if not isinstance(other, int) or self.predicate.arity != 0 or other < 0:
raise NotImplementedError

name, private, special = self.predicate.name, self.predicate.private, self.predicate.special
return factories.AtomFactory.Predicate.get_predicate(name, other, private, special)

def __call__(self, *args) -> "BaseAtom":
if self.terms:
raise Exception
Expand Down

0 comments on commit 502cb0e

Please sign in to comment.