1. Found on HN: Again on 0-based vs. 1-based indexing
- Posted by ghaberek (admin) Jan 19, 2021
- 1026 views
Blog post: Again on 0-based vs. 1-based indexing (HN discussion)
Lua blog post: Lua, a misunderstood language (HN discussion)
-Greg
2. Re: Found on HN: Again on 0-based vs. 1-based indexing
- Posted by Icy_Viking Jan 21, 2021
- 964 views
Blog post: Again on 0-based vs. 1-based indexing (HN discussion)
Lua blog post: Lua, a misunderstood language (HN discussion)
-Greg
Euphoria and Lua have a lot of similarties. I prefer 0-based indexing, but I know Euphoria uses 1 as the starting point. Still I like Eu the most out of all the programming languages I've tried.
3. Re: Found on HN: Again on 0-based vs. 1-based indexing
- Posted by petelomax Jan 22, 2021
- 931 views
Another detailed attempt: http://enchantia.com/software/graphapp/doc/tech/arrays1.html
Concludes with "no clear winner", except for interoperability.
(Dunno about you, but the occasional -1 on the odd c_func() just doesn't really bother me anymore.)
The following languages use 1-based indices: Algol, AWK, COBOL, Euphoria, Fortran, Julia, Lua, Pascal, Phix, Smalltalk
The following languages allow negative indices: Perl, Phix, PowerShell, Python, Ruby
(Dang - I keep on posting this without saying what I came here to say...)
In a language with both 0-based indices and negative indices, apart from the disjoin of a[0] rather than a[1] as first vs. a[-1] as last,
there is no sensible value that eg find() can return that is a non-functional index, whereas in Phix, find() can return 0 and that won't accidentally retrieve the wrong element.