[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Question about .substring

From: Tadziu Hoffmann
Subject: Re: [Groff] Question about .substring
Date: Thu, 20 Nov 2014 18:18:32 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

> If the colon is given then either or both of the indices can
> be omitted.

I see.  So negative indices are a convenience, but index
computation is probably best done using positive indices
because coding the special case would be more awkward:

  i = ... (index counting backward)
  j = ... (other index counting backward)
    j == -0
    b = a[i:]
    b = a[i:j]

> [) has become the norm in "new" languages?

I wouldn't know.  Personally, I think inclusive-inclusive
indexing is more intuitive.  (I also favor languages where
an array of length n has indices 1...n, unless explicitly
declared otherwise: "real, dimension(-5:5) :: a".
But I guess that's just me...)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]