Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
9-liner: operator module solution in Clear category for Boolean Algebra by Stensen
from operator import and_, or_, pow, xor, eq
OPERATIONS = {
"conjunction": and_,
"disjunction": or_,
"implication": lambda x, y: pow(y, x),
"exclusive": xor,
"equivalence": lambda x, y: [0, 1][eq(x, y)]}
boolean = lambda x, y, operation: OPERATIONS[operation](x, y)
Oct. 23, 2020
Comments: