emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 7 logical-xor implementations in source tree


From: Barry Fishman
Subject: Re: 7 logical-xor implementations in source tree
Date: Wed, 31 Jul 2019 11:20:12 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

On 2019-07-30 23:16:16 -04, Richard Stallman wrote:
> Me:
>   > I find the iff and xor not obvious.  xor seems like it should be the
>   > bitwise operation.
>
> That operation is called logxor.  It goes with logior and logand.

I can see keeping the Common Lisp names for things.  Emacs does that
with CAR and CDR.  I have concerns with just replacing one set of
confusing names with others that have differing semantics in other languages..

CL has AND, OR and NOT.  Like CLISP, Emacs has added XOR, but (I think)
with less useful semantics than CLISP's.

I question whether IFF is really that clear.  If you want to be
mathematical, just use <=> or ===, and can be complete by defining the
=> implementation operator also:

(defun <=> (x y) (not (xor x y)))

Or:
(defun => (x y) (or (not x) y)
(defun <=> (x y) (and (=> x y) (=> y x))

At least mathematicians will be happy (and nix programmers).

And possibly give XOR CLISP semantics: takes multiple arguments
returning NIL unless just one argument is true, in which case return
that argument.
-- 
Barry Fishman




reply via email to

[Prev in Thread] Current Thread [Next in Thread]