5 ms·
If the 1st element is [0], something's conceptually wrong.
by hypertele-Xii 3y ago
If the 1st element is [0], something's conceptually wrong.
- adfgoinionio 3y agoWhen did the 21st century begin?
- 6D794163636F756 3y ago[0] just means the address of the element is ptr+0. The first element is at the address from a memory addressing perspective it makes sense that it would be at [0]
- goatlover 3y agoWhy care about the memory address for higher level languages like Lua?
- jackieee 3y agoThe current element is at distance 0 from iter[].
- IshKebab 3y agoYou are right, but the thing that is wrong is that the word "first" is associated with the number 1! Think about it. Natural language could easily have associated the initial ordinal with 0. Let's call it the Nilth (zeroth is really hard to say). The nilth element is element 0, the first element is element 1, etc. The winner of a race is in nilth place. Silver goes to the person who came first. Bronze so second. You walk in to a building on the nilth floor, climb the stairs to the first floor (that might sound weird to Americans but it's how it works in other parts of the world). This is probably all sounding crazy to you but it's way more elegant and self-consistent. Which century is the year 2023 in again?
- evanmoran 3y agoSome of us Americans know our elevator numbers are wrong — zero / nilth is the correct ground floor by far! — but that doesn’t mean when you pick up the first apple in a bowl of apples you should rename it to nilth. Counting order is different from Indexing order. One is the order of objects in a list and the other is the offset (2nd floor is two floors up from zero). They are just different things and that is why they sound right in different contexts! (It’s 2023, and we both are right)
- IshKebab 3y agoCorrect, counting and indexing are different things. But the "first apple" is an index not a count.
- deleted 3y ago[deleted]