3 ms·
Okay, but why are you trying to think about *elements* of a list in terms of offsets from the origin? I mean, that's an important low-level detail to know when
by eigenspace 28d ago
Okay, but why are you trying to think about *elements* of a list in terms of offsets from the origin?
I mean, that's an important low-level detail to know when you're working with assembly or doing pointer math, but it is not something that necessarily needs to be polluting the semantics of a high level language.
I find it much easier to think in terms of v[i] is the i-th element of my vector.
These sorts of things just feel like mental gymnastics people perform to post-hoc justify language quirks.
- defrost 28d agoYou asked for a good argument - I provided one. > but why are you trying to think about a list of elements in terms of offsets from the origin I don't try to think about them in this way - I do and have always thought about them in this way - in software terms for 50 years, in real world cut, saw, and hammer ways for over 60. > I find it much easier to think in terms of ... Which is the crux of the issue really, that's how you think. > v[i] is the i-th element of my vector. I think of V as the start of a row of elements. V+0 is equivalent to V and naturally the start of the first element. V+1 is the start of the row, plus one - the literal start of the second element. I've always thought of V[i] as offsets, "jump overs" if you will. It comes naturally for many that have worked with their hands on physical objects and worked with tape measures. > but it is not something that necessarily needs to be polluting the semantics of a high level language. Either way of thinking works - I spent decades going back and forth from Fortran to C, and people are free to make their high level languages however they wish - it's trivial to move from one to the other. There are even some funky (or eyeball gouging) tricks done to preamble a data run with meta data, leading to V[-1] indexing being commonplace (in some domains)
- eigenspace 28d ago> You asked for a good argument - I provided one. I don't see a good argument though, I just see adaption to a quirky convention. > Either way of thinking works - I spent decades going back and forth from Fortran to C, and people are free to make their high level languages however they wish - it's trivial to move from one to the other. Here I agree. I have no real problem using a 0-based indexed language, I adapt to it quickly (or as you mention a -1 indexed language. Julia itself actually stores type-level metadata at the -1 index of a pointer to a mutable struct) I just dislike when people try and turn every conversation about julia into "oh it's 1-based indexed so that disqualifies it", and act like 0-based indexing is some god-given most natural way to do all indexing.
- defrost 28d ago> , I just see adaption to a quirky convention. Of course you do - you very likely didn't start programming in assembler. You literally asked "How do I get to .." implying you wanting street instructions, distances, etc. In assembler the third element begins literally and straightforwardly at the address base plus two (element widths). That's not "a quirky adaption" is it? It's a dull pragmatic address of the start of the third element - the answer to the question you posed.
- eigenspace 28d agoI did not say "How do I get *to* ..". > Of course you do - you very likely didn't start programming in assembler. I did not, and I do not think that conventions from assembler should influence basic ergnonomic design decisions of modern high-level langauges.