In C and C++, the !
negates the result:
if( !( a == b ) )
In Scheme, I found only eq?
. How do I say "not equal"? Or we have to explicitly say
(eq? #f (eq? expr expr))
To negate a Boolean expression you simply have to apply the DeMorgan theorem recursively: (1) The negation of a sum is the product of the negated variables. (2) The negation of a product is the sum of the negated variables.
Scheme provides us with at least three useful logical operators: AND, OR, and NOT. The only value in Scheme that "means" false is #f. All other values are interpreted as true (including the empty list).
Scheme has a not
, so you could do: (not (eq? expr1 expr2))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With