do...until wisdom needed...
Ben Hutchings
ben.hutchings at roundpoint.com
Wed May 9 14:57:24 EDT 2001
Graham Hughes <ghughes at lynda.com> writes:
<snip>
> I couldn't even write a RC4 stream encryptor in R5RS, because it
> didn't have a logical xor operation.
Oh, please. Any logical expression can be written with only nand
operators or only nor operators. Multiple logical operators are just
syntactic sugar; also, they provide too many ways to do the same
thing.
A xor B = (A or B) and not (A and B)
= not (A nor B) and not (not A nor not B)
= (A nor B) nor ((A nor A) nor (B nor B))
= not ((not A nand not B) nand (A nand B))
= (((A nand A) nand (B nand B)) nand (A nand B))
nand (((A nand A) nand (B nand B)) nand (A nand B))
--
Any opinions expressed are my own and not necessarily those of Roundpoint.
More information about the Python-list
mailing list