Open essepuntato opened 5 years ago
“Spam” not in “spa span sparql” = T
Not (“egg”>”span”)= F
T and F = F
Mmmm.. I wonder if I got this wrong:
("spam" not in "spa span sparql") --> is "spam" not in "spa span sparql"? --> No = True
("egg" > "span") --> is "egg" bigger than "span" (is egg alphabetically bigger than span?) --> No = False
True and not (False)
True and True
True
"spam" not in "spa span sparql" = True and not ("egg" > "span") = True True and True = True
Note: I agree with @delfimpandiani: if "a string S1 is less than another string S2 if the former one precedes the latter one according to a pure alphabetic order" (Table 2, Programming languages lecture notes), I suppose that a string is greater than another string if the former follows the latter in alphabetical order, therefore "egg" > "span" = False because "egg" does not follow "span" in the alphabet.
"spam" not in "spa span sparql" and not ("egg" > "span")
"spam" not in "spa span sparql" = True not ("egg" > "span") = not False = True
True and True = True
"spam" not in "spa span sparql" = True ("egg" > "span") = False --- not False = True According to the Boolean value; True and True = True
"spam" not in "spa span sparql" and not ("egg" > "span") True and not (False) True and True True
"spam" not in "spa span sparql" and not ("egg">"span") T and not F T and t True
"spam" not in "spa span sparql" and not ("egg" > "span")
True and not (False)
True and True
True
"spam" not in "spa span sparql" and not ("egg" > "span")
I phase: brackets and first not don't influence each other so I can do them at the same time. Spam Is not in the string "spa span sparql" so "not" will return True. "Egg" is located before "span" so the operator ">" will return False (egg is "less" than "span") Result: True and not False
II phase: I have to do "not" before "and" Result: True and True
III phase: now I can do the last operation "And" result: True
"spam" not in "spa span sparql" and not ("egg" > "span")
"spam" not in "spa span sparql" and not (False)
True and True
True
Again, we need to execute the operation contained in round brackets "egg" > "span"
. Alphabetically, e is not bigger than s (that is, it comes first in order) so the output is False
. Then we resolve not
operators and, finally, the and
operator.
Question
In the absence of round brackets, string operations have priority over boolean operations right? I was just wondering since "spam" not in "spa span sparql" is not between round brackets but ("egg" > "span") is. It does completely make sense to me if it works like this, otherwise you might have boolean operators operating on strings rather than booleans. If this is correct this would mean that the round brackets around ("egg" > "span") are redundant. Any body could confirm this by commenting the hooray on my question?
What is the boolean value of "spam" not in "spa span sparql" and not ("egg" > "span")?
"spam" not in "spa span sparql" and not (False) >> "egg" should be less than "span" true and not false true
Applied with strings, the logical operator > ("egg" > "span") uses the alphabetic order for the operation, e.g. "a" < "b" is true, because the letter "a" is listed before "b" in the alphabetic order. Based on this rule, the computation "egg" > "span" is false.
"spam" not in "spa span sparql" and not ("egg" > "span") true and not(false) true and true true
"spam" not in "spa span sparql" and not ("egg" > "span")
"spam" not in "spa span sparql" = True not ("egg" > "span") = not (False) True and not (False) = True and True => True
"spam" not in "spa span sparql" and not ("egg" > "span")
"spam" not in "spa span sparql" --> true ("egg" > "span") --> false
true and not (false) true and true true
@HiImBono
Answering your question, indeed all the comparisons will be executed before any other boolean operation.
What is the boolean value of
"spam" not in "spa span sparql" and not ("egg" > "span")
?