Skip to content

Commit

Permalink
allow for two And's to be joined
Browse files Browse the repository at this point in the history
  • Loading branch information
beckydvn committed Sep 19, 2021
1 parent cc7e5ad commit d3dc209
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nnf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __and__(self: T_NNF, other: U_NNF) -> 'And[t.Union[T_NNF, U_NNF]]':
"""And({self, other})"""
# prevent unnecessary nesting
if type(self) == And:
return And({*self.children, other})
return And({*self.children, *other.children}) if type(other) == And else And({*self.children, other})
return And({self, other})

def __or__(self: T_NNF, other: U_NNF) -> 'Or[t.Union[T_NNF, U_NNF]]':
Expand Down

0 comments on commit d3dc209

Please sign in to comment.