pythonpyeda

Pyeda: infix form of boolean expression


Pyeda permits to write boolean expression in prefix form and in infix form:

p = Or(And("A","B"), And("C","D")) # prefix
i = expr("A & B | C & D") # infix

Although it's possible to retrieve automatically from i the relative prefix form, I don't know (no findings in docs) if it's possible to retrieve the string infix representation of p .

Some helps?


Solution

  • PyEDA author here.

    The latest release doesn't have this feature. If you go back to version 0.26.0, you can try the to_latex and to_unicode methods.

    For example:

    >>> p = Or(And("A","B"), And("C","D"))
    >>> p.to_unicode()
    'A · B + C · D'
    

    IIRC, the reason for this omission was the switch from Python to C for the boolean expression engine. A couple undocumented features just got left out b/c it was either difficult, or broken.

    PRs welcome, of course :)