top | item 33708514

(no title)

parekhnish | 3 years ago

Even [closed, closed] intervals have that property: [a, b] + [b, c] == [a, c]

discuss

order

cristoperb|3 years ago

b would be included twice in that case, wouldn't it?

jissa|3 years ago

Right, I think the hotel room use case helps a lot with the intuitions here. And it helps to see the COUNTER EXAMPLE:

* Hotel A [Jan 10, Jan 13] means 4 nights; same as [Jan 10, Jan 14).

* Hotel B [Jan 13, Jan 15] means 3 nights; same as [Jan 13, Jan 16).

These intervals overlap! That is, if I try to get them together I book Jan 13 on both Hotel A and Hotel B.

With the half-open interval is really easy to spot: you cannot concatenate unless the open-end and the closed-begin are the same.

So you can concat [Jan 10, Jan 14) with [Jan 14, Jan 16); BUT you have an overlap if you see this [Jan 10, Jan 14) with [Jan 13, Jan 16) as in the previous examples.

With the closed interval this is hard to see. As in the example by @parekhnish; it seems that [Jan 10, Jan 13] and [Jan 13, Jan 15] are concatenable and there's no overlap. But the final operation ends up booking on Jan 13 twice.