August 27, 2024

P47 - Truth tables for logical expressions (2).

Continue problem P46 by redefining and, or, etc as operators.  (i.e. make them methods of a new class with an implicit conversion from Boolean.)  not will have to be left as a object method.

scala

scala> table2((a: Boolean, b: Boolean) => a and (a or not(b)))
A     B     result
true  true  true
true  false true
false true  false
false false false
Be first to comment
Leave a reply