chickadee » aima » xor

(xor x y) → booleansyntax

Logical xor: whether one or the other proposition is true (but not both)

x
A proposition
y
Another proposition
(define-syntax
  xor
  (lambda (expression rename compare)
    (match expression
           ((_ x y)
            (let ((%or (rename 'or)) (%and (rename 'and)) (%not (rename 'not)))
              `(,%and (,%or ,x ,y) (,%not (,%and ,x ,y))))))))