2 ms·
I find it much more natural to represent "{1,2,3,4,5}" as "1..5" or "range(1,5)", not "1..6" or "range(1,6)".
by Zakharov 15y ago
I find it much more natural to represent "{1,2,3,4,5}" as "1..5" or "range(1,5)", not "1..6" or "range(1,6)".
- sltkr 15y agoDijkstra's point is that you should start counting at 0, so if you want to generate the first five ordinals, you would write [0:5) which yields {0,1,2,3,4} as expected.
- chalst 15y agoIn formal methods its common to have a special notation 0 -> N which is 0 .. N-1. That way, a sequence of length M+N consists of a sequence with indices 0 -> M and a sequence with indices M -> M+N.