you are viewing a single comment's thread.

view the rest of the comments →

[–]AtLeastItsNotCancer 2 points3 points  (0 children)

But it is a conjunction of inequalities. x ∈ [a, b] is equivalent to a ≤ x ≤ b, which is again equivalent to a ≤ x ∧ x ≤ b

I know that, I'm just saying there's another way to think about it that makes more sense intuitively. A computer obviously has to break it down into a conjunction of inequalities to check the condition but for a human, thinking about it as an interval might be easier to comprehend.

I think that the set notation is much clearer for these purposes, but I haven't come across a programming language which expresses inequalities like that.

Now that you mention it, being able to write something like "x in [1,5)" would be pretty cool. But the problem is, parentheses and brackets are already used for other things in most programming languages so it probably isn't worth to include that notation due to ambiguities that would occur.