Finding position of a value in an array

MoonlightSentinel moonlightsentinel at
Tue Dec 31 11:24:29 UTC 2019

On Monday, 30 December 2019 at 23:15:48 UTC, JN wrote:
> I also had to ask because I couldn't find it. In other 
> languages it's named "index()", "indexOf()" or "find()". D is 
> the only language I know which uses the "countUntil" scheme. 
> And even so it's not obvious from the name if it's the index of 
> the element or number of preceding elements.

The main difference to other languages is that countUntil works 
an arbitrary ForwardRanges which might not offer random access, 
hence index would be misleading for them.

But improvements to the documentation could probably help to 
alleviate this confusion.

More information about the Digitalmars-d-learn mailing list