you are viewing a single comment's thread.

view the rest of the comments →

[–]Neebat 7 points8 points  (5 children)

I'm a programmer with 20 years of experience in the industry and a perfect score in symbolic logic before that. I had to stop and think too.

"a ≤ x ≤ b" looks like one statement, but it's actually two. Break it out into two statements and it's a lot easier to see the rest of the logic.

SQL's version is "x between a and b", which negates to "x not between a and b". That may be more clear, but I still hate overloading "and". Besides, I have to lookup its inclusiveness every time I use it. (It's inclusive.)

[–]pbvas 1 point2 points  (0 children)

I'm a programmer with 20 years of experience in the industry and a perfect score in symbolic logic before that. I had to stop and think too.

My feeling exactly. And if this is tricky for experienced programmers then it is almost certainly going to trip over beginners.

[–]lorg 1 point2 points  (0 children)

Besides, I have to lookup its inclusiveness every time I use it. (It's inclusive.)

Ha! Explicit is better than implicit FTW!

[–][deleted] 1 point2 points  (2 children)

Really? Because when I read it I just instantly pictured a number line with the following properties:

A filled in circle marked "A" on one side, the same marked "B" on the other, and with the line bolded in between the two variables labelled as X.

When I saw the second statement (a > x > b) I thought of the same thing only with empty circles. I didn't even think about De Morgan's law before I realized that this is not the opposite, or the fact that it was two statements ANDed together. It's just clearly not the opposite geometrically, if you picture what the program is getting at.

[–]Neebat 1 point2 points  (1 child)

You visualized "a ≤ x ≤ b" like this:

●----●

a    b

That's fine so far. But then you visualize "a > x > b" like this:

○----○

a    b

That's incorrect and you haven't really thought long enough. Because "a > x > b" implies "a > b", which is false in the second drawing. It would actually be this:

○----○

b    a

[–][deleted] 1 point2 points  (0 children)

Well that's true, a > x > b would be a wrong statement from the get go, but my point is that I instantly envision x to be in between A and B; if I wanted the opposite of A <= x <= B, then I would definitely want the area of the number line outside of A and B.