Re: No xor!!!
On Mon, 26 Oct 1998, Matt Z Nunyabidness wrote:
> Why is there no xor operator, imp, or eqv? How do you xor stuff if you
> don't have it???
I assume you want to do things like:
if a = 3 xor b = 4 then...
Easy. Just do this instead (note the brackets. They *have* to be there to
use this trick):
if (a = 3) != (b = 3) then...
^^^^-xor is bitwise inequality
For eqv:
if (a = 3) = (b = 4) then...
^^^-eqv is bitwise EQuiValence
For imp:
if (a = 3) or not (b = 4) then...
^^^^^^^^-imp is logical IMPlication (not obvious here)
If you're not wanting logical expressions, but bitwise operations,
Euphorias 1.5+ have the functions
and_bits(), or_bits() and xor_bits().
There may be some old libraries out there that emulate these using
int_to_bits(), bits_to_int(), and "not", "and" and "or".
HTH,
Carl
--
Carl R White -- Final Year Computer Science at the University of Bradford
E-mail...: cyrek- at -bigfoot.com -- Remove the hyphens before mailing. Ta :)
URL......: http://www.bigfoot.com/~cyrek/
Ykk rnyllaqur rgiokc cea nyemdok ymc giququezka caysgr -- B.Q.Vgesa
|
Not Categorized, Please Help
|
|