4 ms·
Also, I find his case that notation option A is best to be extremely unconvincing. He just lists 2 properties that he thinks are good: 0. Subtracting the lower
by tkfu 7y ago
Also, I find his case that notation option A is best to be extremely unconvincing. He just lists 2 properties that he thinks are good:
0. Subtracting the lower bound from the upper yields the length of the sequence.
1. For adjacent sub-sequences, the upper bound of the lower sequence will equal the upper bound of the lower sequence.
One could just as easily argue for option C (a ≤ i ≤ b) by pointing out that
0. It's much closer to natural language ("all the numbers from a to b"), and thus less likely to be casually misunderstood.
1. It uses the same inequality symbol twice, making it quicker and easier to understand.
2. If either of the bounds of one sub-sequence is inside the bounds of another sub-sequence, those two sub-sequences overlap.
- arh68 7y agoYes, I would agree. His logic is that we should cater to the empty sequence case, and it would be "unnatural" to write 2 <= x <= 1, so we have to write 2 <= x < 2. That is just not an improvement. Ask somebody to write down an empty sequence, starting at 2, they'll think you're crazy. The Common Case is give the First and Last. Option C is, to me, obviously best. How you can replace 2 .. 12 and not use 2 & 12 is beyond me. (/s Dijkstra's opinions considered harmful /s)