Why would the Scheme interpreter demand numeric arguments for not
?
In my case:
(not (= 1 2))
returned the following error:
-: contract violation
expected: number?
given: #f
context...:
stdin::1135: not
This is rather contrary to my 20-minute experience with the SICP, according to which not
is a logical composition operator and its operands are supposed to be logical too.
Here comes the funniest part: the error is not reproducible. I know it sounds stupid, but I launched Racket once, got this error, re-launched it and the error was gone (i.e. not
switched to returning proper logical values). Does anybody have an idea why might that happen? Is there something that I'm unaware of that affects Scheme's or Racket's behavior?
Note: I didn't modify the environment in any way, in neither of the cases. The only thing I did was enter the expression above.