[plt-scheme] boolean operators on integers

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Jul 12 09:49:01 EDT 2008

If that's not what you want, you'll need to use a different operator...

You could, in some place just convert numebrs to booleans, eg:

  (lambda (x) (not (= x 0)))

is a function that does that conversion. Or you could define
(straightforward) macros that were analogs of and/or/etc but that
operated on numbers. They would just insert the above coercion into
the arguments to the original and/or/etc.

Robby

On Sat, Jul 12, 2008 at 8:44 AM, wooks <wookiz at hotmail.com> wrote:
>> (and 1 0)
> 0
>> (and 0 1)
> 1
>
>> (and 1 0 0)
> 0
>> (and 0 0 1)
> 1
>> (and 0 1 0)
> 0
>> (and 0 1 1)
> 1
>
> Seems like and is just returning the value of the last argument.
>
> The integers 0 and 1 are supposed (for my purposes ) to be boolean
> flags true and false so this is not the behaviour that I want.
>
> Using language Pretty Big.
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>


Posted on the users mailing list.