News for hackers. Stuff that matters.
Re:Again on 0-based vs. 1-based indexing by codeflo on Wednesday January 20, 2021 @06:22AM (#25845093)
I think the most mathematically natural way to interpret negative indices is to threat them as numbers modulo list length. Then 0 = length, and -1 = length - 1.
Re:Again on 0-based vs. 1-based indexing by bvrmn on Wednesday January 20, 2021 @01:09PM (#25849744)
C programmers can give you a couple of advises about "correct" modulo on negative numbers.