On 2017/10/06 11:31 AM, Simon Slavin wrote:
On 6 Oct 2017, at 9:12am, Rowan Worth <row...@dug.com> wrote:
On 6 October 2017 at 15:42, <no...@null.net> wrote:
On Fri Oct 06, 2017 at 09:28:08AM +0200, Clemens Ladisch wrote:
For boolean values, "a XOR b" = "a <> b".
Is the <> operator documented somewhere? I can't find it in either of
these places:
<> is SQL for "not equal to" (shout out to all the BASIC fans). It’s documented 
here:
https://sqlite.org/lang_expr.html#binaryops
That page says that '<>' means 'non-equals'.  This is not the same as the 
binary operation 'XOR' since 'non-equals' can yield only two values: true and false.  
Experimentation shows …

sqlite> SELECT 11 = 19;
0
sqlite> SELECT 11 <> 19;
1
sqlite> SELECT 11 | 19;
27
sqlite> SELECT 11 & 19;
3

He did say "Boolean" XOR, the tests above are for Binary (as in base-2 arithmetic, not 2-sided equations) XOR.  He did give a formula for Binary XOR, which does work.

I agree the documentation could be clearer and it would be nice to have an XOR operator in the way that & and | work...  Is there any character left to use, or one that are regularly used as XOR in other languages?  The $ sign seems to be free, but it would be nice to conform to some standard. Perhaps a combined "<|" or such.

I'd also like to see a Unary NOT operator, such that you can say: a = !b
But, I guess that's only feasible in a strongly typed language.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to