bastikr / boolean.py

Implements boolean algebra in one module.
BSD 2-Clause "Simplified" License
76 stars 34 forks source link

Evaluate #76

Closed gemerden closed 4 years ago

gemerden commented 7 years ago

adds ability to evaluate boolean expressions, as in:

algebra = BooleanAlgebra() exp = algebra.parse("!(a|b&(a|!c))")

a, b, c = True, False, True assert exp(a=a, b=b, c=c) == not(a or b and (a or not c))

gemerden commented 7 years ago

i split the import and made reduce to be imported under python 3.

gemerden commented 6 years ago

Any chance of having this PR merged into master?

pombredanne commented 6 years ago

@gemerden sure! let me review and merge. Thanks for updating and ensuring the tests pass.

pombredanne commented 6 years ago

Looking all good to me. I will merge but I need to decide on a merging strategy with regards to the changes by @all3fox first! Thank you for your patience!

pombredanne commented 6 years ago

@gemerden I worked on rebasing #72 on the latest master, so there is some progress, at last. Do you need support for Python2 for this or only Python3?

Kronuz commented 6 years ago

Please do keep support for Python 2, I need that.

pombredanne commented 6 years ago

@Kronuz So do I for sure. So we will keep this alright: The only thing is that these will be two different branches in a near future and will have a few but minor differences (mostly because the transpilation to JS works only on Python3). And I will keep backporting to the Python2 branch as needed for the foreseeable future. Alternatively we could consider the opposite and applying some automated transformation script to the Python2 sources to make then Python3 and transpilable to JS? Not sure what is the best way.

gemerden commented 6 years ago

For now i have used boolean.py in a slightly different manner, so i won't be using this directly for now. Therefore do as you like.

gemerden commented 4 years ago

Any progress on this PR, it seems such a logical thing to add.

gemerden commented 4 years ago

@pombredanne any progress on this, python3 only would be fine for me.

pombredanne commented 4 years ago

@gemerden sorry for dropping the ball here! do you mind rebasing on the latest develop branch?

pombredanne commented 4 years ago

@gemerden I would like to get this in the next release soon enough ... Tell me if you can rebase, otherwise I will try to handle it

gemerden commented 4 years ago

Good news, also i have never used rebase (and i have no idea what has been changed on master or develop, haven’t looked at the repo since i made the PR), so if you could do it that would be great. I will help as needed ofcourse.