6 ms·
I don't find Dijkstra's argument unassailable: let's claim instead that half-open intervals are ugly (they are asymmetrical, and not typically used in mathemati
by ronaldx 13y ago
I don't find Dijkstra's argument unassailable: let's claim instead that half-open intervals are ugly (they are asymmetrical, and not typically used in mathematics) and closed intervals are preferable.
Given that, his arguments support 1-indexing better.
- mauricioc 13y agoThe claim doesn't hold. Half-open intervals appear in important places. That happens mainly because the family of finite unions of half-open intervals is closed under complement (that is, they form a semi-ring; this is unrelated to the "ring" concept in abstract algebra). In measure theory, one form of the Carathéodory extension theorem [0] says that you can uniquely extend a measure on a semi-ring to an actual measure (defined on a sigma-algebra). The equivalent statement in probability theory says that a probability is uniquely determined by its cumulative distribution function, which are sometimes nicer to take limits of. You can also get a probability from a cumulative distribution function, provided your function is right-continuous [1] (which is directly related to half-open intervals). For more examples of half-open intervals in probability, you can look at stochastic processes. See, for example, càdlàgs [2] and Skorohod spaces; they capture the notion that processes that "decide to jump" (think of Markov chains changing states if you like) are right-continuous. IMO, half-open intervals are just nicer whenever you have to union them or intersect them, and are no worse in other aspects when compared to closed intervals. Also, I think the author makes a big cultural blunder when he dismisses "mathematical aesthetics" as a valid reason. A significant number of mathematicians think of elegance as the ultimate goal in mathematics; as Hardy famously said, "There is no permanent place in the world for ugly mathematics". [0] http://en.wikipedia.org/wiki/Carath%C3%A9odory%27s_extension_theorem http://en.wikipedia.org/wiki/Carath%C3%A9odory%27s_extension... [1] Well, we also need the obvious conditions: Correct limits at infinity and monotonicity. [2] http://en.wikipedia.org/wiki/C%C3%A0dl%C3%A0g http://en.wikipedia.org/wiki/C%C3%A0dl%C3%A0g
- ronaldx 13y ago> provided your function is left-continuous Yes, but we are talking about indexing discrete arrays. All of your examples are continuous, and are not analogous.
- mauricioc 13y agoI was replying to your "not typically used in mathematics" quote. As to the "and [thus] are not analogous" part, I recommend the Concrete Mathematics book. You'll certainly see at least a hundred examples of continuous examples alongside with their discrete counterparts, as you can imagine by looking at the book title. Half-open intervals feature prominently when doing discrete calculus in the Sums chapter.
- sesqu 13y agoWhat's more, half-open intervals are more naturally 1-based, setting the missing point at 0. Dijkstra's arguments are very assailable, despite being trotted out in every discussion as arguments from authority. The crux of the issue is treating indices as offsets rather than identifiers, which is perfectly reasonable if and only if one is directly working with sequential memory.