[plt-scheme] Re: boolean operators on integers

From: wooks (wookiz at hotmail.com)
Date: Sat Jul 12 10:01:13 EDT 2008


On Jul 12, 8:53 am, "Shriram Krishnamurthi" <s... at cs.brown.edu> wrote:
> 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?

because
a) my function has several of these boolean type arguments
b) 0 has fewer characters than #f and false
c) I thought it would work

there - stupid but honest.

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

ok.... and I learnt interesting useful along the way.



Posted on the users mailing list.