How do you express Boolean negation in Scheme?

Chan picture Chan · Apr 22, 2011 · Viewed 10.3k times · Source

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))

Answer

Jerry Coffin picture Jerry Coffin · Apr 22, 2011

Scheme has a not, so you could do: (not (eq? expr1 expr2))