4 ms·
I have tried Julia few times and each time this is what stops me. I don't understand why they decided to make indexes R-like oposed to "all other languages"-lik
by gozzoo 7mo ago
I have tried Julia few times and each time this is what stops me. I don't understand why they decided to make indexes R-like oposed to "all other languages"-like. My brain just stops working when i need to recalculate indexes and each time I'm wrong.
Some people may not realize it, but when it comes to programming languages, ergonomics matter—a lot.
- leephillips 7mo ago“All other languages” such as Fortran, etc.? Why are you recalculating indices? I don’t think that any Julia program I’ve ever written would need to change if Julia adopted 0-based tomorrow. You don’t typically write C-style loops in Julia; you use array functions and operators, and if you need to iterate you write `for i in array ...`. “ergonomics matter” Definitely. Ergonomics is the main reason I enjoy Julia. Performance is a bonus.
- Certhas 7mo agoWe had this discussion on here recently. It's really puzzling to me. Julia has the most ergonomic array interface I have worked with by far. How did 1 based indexing ever trip you up?
- Tarq0n 7mo agoThat's just you being unable to let go of your biases? In languages with pointers giving primacy to offsets makes sense. In every other context aligning with natural language and math (first, second, 1..n inclusive) is perfectly logical.
- wolvesechoes 7mo agoAnd 1-based indices are much more natural and ergonomic to everyone that doesn't pretend to be a machine. When I think about n-th element of a vector, its offset is not the first thing I am interested in.
- pjmlp 7mo agoOutside curly languages there are plenty of 1 based to chose from, or that have the flexibility to chose the actual range.