[plt-scheme] boolean operators on integers

Shriram Krishnamurthi sk at cs.brown.edu
Sat Jul 12 09:53:37 EDT 2008


1. In Scheme, 0 and 1 are both true values.  Neither of them is false.
In Scheme, only one value is false: #f, or false.

2. In Scheme, AND returns the value of the last expression so long as
it isn't false.

You're seeing the combination of these two behaviors.

Why are you using 0 instead of #f/false to represent a false value?
Or is it that 0 represents falsity in your domain, and you need to map
it to false?  If so, use the code Robby sent.

Shriram



More information about the plt-scheme mailing list