6 ms·
Why? Seems completely correct and good. You either have an empty range be -1 .. 0, which is ugly, or 0 .. -1, which is also ugly. Thus, start-inclusive, end-ex
by FeepingCreature 3y ago
Why? Seems completely correct and good.
You either have an empty range be -1 .. 0, which is ugly, or 0 .. -1, which is also ugly. Thus, start-inclusive, end-exclusive.
- personalityson 3y ago"That is ugly" is what separates math (1-indexing in Fortran, R, SAS, SPSS, Matlab, Mathematica, Julia) from the apes This and column-major order for matrices (a vector is a column, not a row)
- fosforsvenne 3y agoI'm not seeing the superior ironcladness in this statement. I must be an ape.
- forgetfulness 3y agoThose languages are made for writing throwaway code that sometimes is made to suffer in agony for years, when it wasn't written to be revised more than a week later. We can be thankful that this applied physicist in particular decided to dedicate time to think carefully about the needs of who would be his colleagues and successors, when he was pretty much inventing programming as a profession; he told of the anecdote of when he got married, and he wasn't able to write in "programmer" as his occupation in the Dutch paperwork, because it didn't exist as a job category yet.
- leereeves 3y ago1 < i < 1 is also ugly. Better to write false, or remove that conditional entirely. And then, once you remove empty ranges, there's no reason to to choose a range style based on which you prefer for an empty range.