News for hackers. Stuff that matters.
Re:Again on 0-based vs. 1-based indexing by erhk on Wednesday January 20, 2021 @06:10AM (#25844995)
I see myself losing hours on this typo
Re:Again on 0-based vs. 1-based indexing by bregma on Wednesday January 20, 2021 @07:32AM (#25845661)
We need a language that goes one better, like a cross between Python and Ruby that uses two spaces for closed ranges and three spaces for open.
Re:Again on 0-based vs. 1-based indexing by TuringTest on Wednesday January 20, 2021 @12:13PM (#25848952)
How about using different symbols?

   |-1..12-|.to_a ## e.g. months in a year
    #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]

    /1..\13.to_a  ## e.g. hours from 1h (1AM) to 13h (1PM)
    #=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
It requires compiler support, but hey, you said a new language.
Re:Again on 0-based vs. 1-based indexing by ZephyrBlu on Wednesday January 20, 2021 @06:42AM (#25845228)
I couldn't tell the difference for quite a few seconds there.
Re:Again on 0-based vs. 1-based indexing by sergeykish on Wednesday January 20, 2021 @12:17PM (#25849007)
I see children losing hours on range(1, 12) in Python, have you noticed error? Unsafe defaults introduced to reuse function as

    for i in range(len) # 0, 1, ..., len - 1