logical NOT operator
Posted: 29 Jul 2004 22:54
Is there some plans concerning logical operator "NOT" using in search expression?
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
Since you seem to be a search logic enthusiast: suggest a symbol/operator/syntax for NOT, please.Leopoldus wrote:There are three logical operator commonly used in searching...
No, I'm not. Indeed I hate ityou seem to be a search logic enthusiast
Do you mean Explorer to be The Standard of Perfect Search Utility?Explorer file search can't do NOT, right?
I don't think it would be very difficult task.suggest a symbol/operator/syntax for NOT
This "one" is not me, surely. I realize how complex is this task. Wnen I've written "I don't think it would be very difficult task.", I had meaned my own task to suggest the sign for the logical operator, not your mission to implement logical operator into your program.It's not as easy to implement as one might think.
Code: Select all
Search Syntax Boolean Equivalent
cat "cat"
-cat NOT "cat"
cat dog "cat" AND "dog"
cat -dog "cat" AND NOT "dog"
-cat -dog NOT "cat" AND NOT "dog"
cat or dog "cat" OR "dog"
pig or cat dog ("pig" OR "cat") AND "dog"
pig or cat -dog ("pig" OR "cat") AND NOT "dog"
Escape character: \
\-cat "-cat"
cat\ dog "cat dog"
cat \or dog "cat or dog"
etc.
These too? (I'd rather not... too confusing)
-pig or cat NOT (pig OR cat) ???
(NOT pig OR cat) ???
-pig or -cat NOT (pig OR NOT cat) ???
(NOT pig OR NOT cat) ???
Code: Select all
Search Syntax A Search Syntax B Boolean Equivalent
cat cat "cat"
not cat ! cat NOT "cat"
cat and dog cat & dog "cat" AND "dog"
cat and not dog cat & ! dog "cat" AND NOT "dog"
not cat and not dog ! cat & ! dog NOT "cat" AND NOT "dog"
cat or dog cat | dog "cat" OR "dog"
pig or cat and dog pig | cat & dog ("pig" OR "cat") AND "dog"
pig or cat and not dog pig | cat & ! dog ("pig" OR "cat") AND NOT "dog"
not pig or cat and dog ! pig | cat & dog NOT ("pig" OR "cat") AND "dog"
Escape character: \
\! cat "! cat"
cat \and dog "cat and dog"
cat \& dog "cat & dog"
etc.
Which tells me you're not a programmer. ! is the standard NOT-operator in languages like C, C++, Java, JavaScript, PHP and more. All those languages also have & for AND and | for OR. So ! for NOT is a very obvious choice here, and not my own idea at allGandolf wrote:I don't think I've ever seen the " ! " used as a not operator - excellent idea.
My plan was to allow version A and version B at the same time, being friendly to more "verbal" thinkers.Gandolf wrote:I like version B...
Well, that's what I call a real programmer!Gandolf wrote:An ex-programer. Control system software in the 1980's using Z80 and 6800. High level languages hardly existed...
Code: Select all
Search Syntax A Search Syntax B Boolean Equivalent
cat cat "cat"
not cat ! cat NOT "cat"
cat and dog cat & dog "cat" AND "dog"
cat and not dog cat & ! dog "cat" AND NOT "dog"
not cat and not dog ! cat & ! dog NOT "cat" AND NOT "dog"
= NOT ("cat" OR "dog")
cat or dog cat | dog "cat" OR "dog"
pig or cat and dog pig | cat & dog "pig" OR ("cat" AND "dog")
pig or cat and not dog pig | cat & ! dog "pig" OR ("cat" AND NOT "dog")
not pig or cat and dog ! pig | cat & dog NOT "pig" OR ("cat" AND "dog")
Escape character: \
\! cat "! cat"
cat \and dog "cat and dog"
cat \& dog "cat & dog"
etc.
This happened to me, too. I think the ";"-operator for OR should be kept alive as an alternative to " | " and " or " because it's already generally known from file open dialog patterns like "*.ico;*.gif;*.jpg". Right?Gandolf wrote:... I'm quite happy with " & " and " | " even though it caught me out after you'd changed it and I recalled an expression from the history with the ";" and then wondered why it couldn't find the files!!!