News for hackers. Stuff that matters.
Re:Again on 0-based vs. 1-based indexing by elcomet on Wednesday January 20, 2021 @03:31AM (#25843968)
For 2), in Julia, there is "mod1" function which acts as modulo, with 1 being the smallest value instead of zero. It doesn't really make sense mathematically, but is very useful for looping over circular arrays.
Re:Again on 0-based vs. 1-based indexing by im3w1l on Wednesday January 20, 2021 @05:19AM (#25844653)
EDIT: This is actually wrong, because it doesn't correctly describe how negative arguments are handled.

It can be phrased mathematically like this:

Consider the equivalence relation a ≡ b (mod n). It has n equivalence classes. Use 1..n as the canonical elements for the classes.

mod1 takes a number, finds its equivalence class and returns the canonical element.

Re:Again on 0-based vs. 1-based indexing by user-the-name on Wednesday January 20, 2021 @05:20AM (#25844660)
Does it have it for any other reason than to work around the limitations of 1-based indexing?
Re:Again on 0-based vs. 1-based indexing by naniwaduni on Wednesday January 20, 2021 @02:49PM (#25851069)
12-hour timekeeping, perhaps ;-)