Macaulay2 » Documentation
Packages » Macaulay2Doc » The Macaulay2 language » operators » xor
next | previous | forward | backward | up | index | toc

xor -- exclusive disjunction

Description

If t and u are booleans, then t xor u returns true if exactly one of them is true.

i1 : even 7 xor isPrime 7

o1 = true

If they are both functions than return booleans, then the return value is also a function.

i2 : isEvenXorPrime = even xor isPrime

o2 = isEvenXorPrime

o2 : FunctionClosure
i3 : isEvenXorPrime 7

o3 = true
i4 : isEvenXorPrime 2

o4 = false

See also

Ways to use symbol xor:

  • Boolean xor Boolean
  • Function xor Function

For the programmer

The object xor is a keyword.

This operator may be used as a binary operator in an expression like x xor y. The user may install binary methods for handling such expressions with code such as

         X  xor  Y := (x,y) -> ...

where X is the class of x and Y is the class of y.


The source of this document is in Macaulay2Doc/operators.m2:388:0.