4 ms·
Yes. It looks wrong and feels wrong. I can adjust to indentation styles, programming styles, etc. but 1-based indexing is an absolute deal-breaker for me. It's
by Asooka 6y ago
Yes. It looks wrong and feels wrong. I can adjust to indentation styles, programming styles, etc. but 1-based indexing is an absolute deal-breaker for me. It's one of the few things the programming community has settled on - indexing starts at 0, as it is mathematically the most natural start.
- leephillips 6y agoThe scientific programming community, starting with Fortran, has, on the contrary, settled on 1, because it is mathematically the most natural start.
- sidpatil 6y ago> It's one of the few things the programming community has settled on - indexing starts at 0, as it is mathematically the most natural start. When you're in the supermarket and you're counting how many items are in your shopping cart, do you start from 0?
- Jtsummers 6y agoIt depends on what you think you're doing. If you are counting, 1-based makes a lot of sense. If you're indexing, they're equally valid approaches. However, if you're indexing then you should be able to use an arbitrary range and not be restricted to one or the other (with a mapping function from your actual range to the language's base).
- mcguire 6y agoYou start with an empty cart, right?
- dragonwriter 6y ago> When you're in the supermarket and you're counting how many items are in your shopping cart, do you start from 0 Yes, because the cart starts empty. But, more to the point, I don't call the thing I put into the cart that causes it not to be empty the zeroth item.
- cratermoon 6y agoDatabase auto-indexed columns have entered the chat.
- bmitc 6y agoAnd yet, the set of natural numbers in mathematics is most often taken to start at 1. Mathematicians don’t have a problem with indexing.
- mcguire 6y agoIs it? Most nat's are built from zero and succ(n) in my experience.
- vcxy 6y ago(I'm a mathematician) Honestly, not that many people in math think about the construction of the natural numbers frequently. Yeah, we learn about it of course, but that's about it. Very often the natural numbers do not include 0. Often they do. I've seen $\mathbb Z_{\geq0}$ and $\mathbb Z_+$ used to avoid having to worry about it. Hell, different countries can't even agree on whether 0 is positive. In France, 0 is considered both positive and negative. In USA, 0 is considered neither. (quick edit: I realize my last paragraph makes the $\mathbb Z_+$ option seem weird. I do math in the States.)
- mcguire 6y agoThat's what Wolfram Mathworld suggests: specifying a subset of the integers. :-)
- lupire 6y agoOnly if you need zero, which you don't need for indexing. Peano's original axioms started from 1 (which is logically equivalent to starting from 0, or -1, or potato) if all you are doing is counting)
- randomswede 6y agoIn Sweden, the set usually referred to as "de naturliga talen" (the natural numbers) is any number n such that 0 <= n. Or, at least, that was the case when I did maths there. No idea what the default interpretation is these days. This is mostly why I don't say "natural numbers" and instead say "positive integers" or "non-negative integers", depending on if I want 0 included or not.