I am currently creating syntax conditions and have read the condition syntax reference. While I saw from the tutorials that the operator that seems to be most often used to express AND is &^, I saw that there are two more AND operators, & and &=. From the descriptions, I think I get the difference between &^ and &=, but I am not sure when one would have to use just &. I cannot think of a use case for that.
That is a very good question you asked. I like our condition syntax because you can code conditions with
basic syntax that catches 90% or more of the cases ( these are + and & )
extended syntax that allows you to adjust for highly specialized cases (creating exceptions, etc)
&^ as I think you saw, means different match
%CITIES.LIST &^ %COUNTRIES.LIST would be true for “Chicago, Jamaica” but false for a simple input “Jamaica”
& means the condition parts around the AND(s) could match for the same words in an input. The condition %CITIES.LIST & %COUNTRIES.LIST would be true for both “Chicago, Jamaica” and “Jamaica”. In the case of the simple input “Jamaica” - that slips through because there are also some cities called Jamaica. So &^ prevents a potential source of error where you have overlapping language objects.
So the reasons to use & are not that substantial:
& means somewhat simpler looking conditions (if you know lobs are totally unique)
& is more efficient for engine to evaluate (though with today’s computing power, this may be an imaginary difference).
Reason to use &^ (different match):
More robust.
Guarantees that the condition parts match on different words/phrases
thanks for your explanation! I think I see a little clearer now… I was just wondering whether there is a use-case where it would be advantageous to use the & operator over the &^ operator? Is there cases where you want to leave it underspecified whether you want both parts of the condition on the same words in an input or on different words?
Just being curious
For my current flow, I think I know now which one to use.
Hi John, I’d recommend using &^ as it is more precise and also consistent with auto-coding, which uses different match by default.
The only use case I can think of unique to & would be: Find a sentence that has each of the following, and they can be the same or different tokens(words): a proper noun, a first name, a noun:
Honestly, I’ve never come across a case where you had to do this. But it doesn’t mean there aren’t any. Perhaps writing some kind of bot to analyze grammar?