logical NOT operator

Features wanted...
Gandolf

Post by Gandolf »

Yes, I'm happy with the 2 parallel versions A and B. I'd use the B version in preference.
It's been very hot in London as well but we're now in the middle of a very violent, and impressive, thunderstorm.

Dave.

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

I'm making good progress. Here's the new, and probably final, state of the TrackerV3 Boolean file search syntax.

Code: Select all

Boolean Operators in TrackerV3
  OR:   |, or, OR     (must have a space on both ends)
  AND:  &, and, AND   (must have a space on both ends)
  NOT:  !             (no spaces)

Operator precedence
  NOT > AND > OR

Examples
  Search Syntax     Alternative Syntax    Boolean Equivalent
  
  cat                                     "cat"
  !cat                                    NOT "cat"
  cat & dog         cat and dog           "cat" AND "dog"
  cat & !dog        cat and !dog          "cat" AND (NOT "dog")
  !cat & !dog       !cat and !dog         (NOT "cat") AND (NOT "dog")
                                          = NOT ("cat" OR "dog")
  cat | dog         cat or dog            "cat" OR "dog"
  pig | cat & dog   pig or cat and 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 dog   (NOT "pig") OR ("cat" AND "dog")

Escape character is \
  \!cat                                   "!cat"
  !\!cat                                  NOT "!cat"
  cat \& dog                              "cat & dog"
  cat \and dog                            "cat and dog"

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Gandolf wrote:It's been very hot in London as well but we're now in the middle of a very violent, and impressive, thunderstorm.
'Tis a bit cooler today, so I took a chance on the NOT implementation, and here it is! :D
I tested thoroughly, and you should, too! Syntax works as stated in my last posting.

Donald

Gandolf

Post by Gandolf »

Should there be a link to the download?
Not sure I like the "!" without a space. The space makes it stand out better from the text, but I'll see how it goes.
I agree about not using the ";" - too many options for the same thing can lead to confusion.

Having seen in the History.txt file

! fixed minor bug
!!! fixed major bug

Does that mean NOT fixed minor bug and NOT NOT NOT fixed major bug.

Dave.

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Gandolf wrote:Not sure I like the "!" without a space. The space makes it stand out better from the text, but I'll see how it goes.
I like it better, and it aptly shows the binding of the operator to just this term (whereas the other operators combine two terms). You'll get used to it.

Gandolf

Post by Gandolf »

Agreed, point taken. I hadn't thought about it in that way.

I've done some fairly detailed find checks and all appears to work as I expected, so it looks good.

Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

Post by Leopoldus »

So, AND precedes OR by default (and there's no way to overwrite the default because I do not want to introduce parentheses - it would just be too much).
Thank you for NOT-operator implementing, but I think parentheses-based syntax would be much more flexible and clear for any user at the same time:
((m* | aa*) & (!*.jpg)) & bb*

And if you decided to use exclamation sign without space (very good decision!), woud it possible to exlude spaces from "&" and "|" syntax? I think the whole syntax must be uniform...

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Leopoldus wrote:... I think parentheses-based syntax would be much more flexible and clear for any user at the same time:
((m* | aa*) & (!*.jpg)) & bb*
Well, I think parentheses-based syntax would be an overkill for the majority of users (and quite tricky to implement). Your example shows that clarity is not automatically achieved with parentheses (you probably did not concentrate too hard while typing it ;)):
(a) it has two superfluous parentheses and should read: (m* | aa*) & (!*.jpg) & bb*
(b) it will not find a single file on any system (do you see why?)
Leopoldus wrote:And if you decided to use exclamation sign without space (very good decision!), woud it possible to exlude spaces from "&" and "|" syntax? I think the whole syntax must be uniform...
I find it harder to read without the spaces. Did you try it?

Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

Post by Leopoldus »

you probably did not concentrate too hard
No, I did not at all. It was not my aid to create really working sample of inquire, but only to iilustrate my thought grafically. OK, you are right, it seems to be not a very good sample :oops: But a bad implement must not destroy the conception itself.
I find it harder to read without the spaces. Did you try it?
Yes, it is harder to read, but exactly three time more comfortable and quicker to input.
And it is not so much harder to read as well:
aa&bb|cc&!dd
aa & bb | cc & !dd

There is another solution too. You coud make the app to ingnore all spaces in inquire:
aa & bb | cc & !dd = aa&bb|cc&!dd
In this case any user can choose oneself if reading or writing is more important for him.

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

Leopoldus wrote:And it is not so much harder to read as well:
aa&bb|cc&!dd
aa & bb | cc & !dd
Hmm, hard enough.
Leopoldus wrote:There is another solution too. You coud make the app to ingnore all spaces in inquire:
aa & bb | cc & !dd = aa&bb|cc&!dd
In this case any user can choose oneself if reading or writing is more important for him.
But what if you're looking for spaces in the filename? Ignoring all spaces would sabotage that. And, as it is now, you can look for a file called "a&b.txt" without using escapes. With your system you would have to write "a\&b.txt".

I'd like to hear other voices, please.

Donald

Leopoldus
Posts: 237
Joined: 24 Jun 2004 10:58

Post by Leopoldus »

But what if you're looking for spaces in the filename? Ignoring all spaces would sabotage that. And, as it is now, you can look for a file called "a&b.txt" without using escapes. With your system you would have to write "a\&b.txt".
Well, filenames may content spaces and service symbols (as "&"), but I suppose nobody never really includes neither spaces nor special symbols in search inquire, but only letters (and may be figures sometimes).
Let others tell am I right or not.

admin
Site Admin
Posts: 60567
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Post by admin »

I really don't see what's so hard about typing some spaces. We do it all the time, almost unconsciously, and for good reason it's the biggest key on the keyboard. Actually, to me (and to many others, I guess) it feels natural to separate terms by spaces. I would have to force myself NOT to do it.
The NOT-operator is different, it's like a semantic prefix: sure vs unsure. It (dis)qualifies the term it is prefixed to.

Post Reply