develooper Front page | perl.perl5.porters | Postings from January 2014

Re: Range idea

Thread Previous | Thread Next
January 23, 2014 19:39
Re: Range idea
Message ID:
Aristotle Pagaltzis wrote:
>It bothers me that indexing from the front of the list is 0-based but
>indexing from the end of the list is 1-based.

I view them both as being zero-based, but with the indexes referring
to the gaps between elements rather than to the elements themselves.
Zero refers to either edge of the array.  Think about how negative
indices work with splice().  Then when you're referring to an element
you use the index of that element's left edge.  It's only at that last
step that any asymmetry arises.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About