"bearophile" <[email protected]> wrote in message news:[email protected]... > Andrei: > >> Aside from the fact that "range" has another meaning in D, the word does >> not convey the notion that iota adds incremental steps to move from one >> number to another. "Iota" does convey that notion. > > I have accepted the "iota" name, it's short, easy to remember, it has one > historical usage in APL, and "Range" has another meaning in D (but it's > weird, and it's something you need to learn, it's not something a newbie > is supposed to know before reading D2 docs well. The name "interval" is > better, simpler to understand, but it's longer for a so common function). > > But this answer of yours is stepping outside the bounds of reasonableness > :-) If you ask a pool of 20 programmers what range(10,20) or iota(10,20) > means, I'm sure more people will guess range() correctly than iota(). The > word range() do convey a complete enumeration of values in an interval. > iota() does not convey that. > > Said all this, I suggest to introduce the first-class a..b interval syntax > in D (or even a..b:c), this is able to remove most (all?) usage of iota(). >
I like "interval", too. I do think the name "iota" is a nice extra reason to just use a..b or a..b:c like you say. It also makes it clear that it's a series of discrete values rather than a true mathematical range, since that's exactly how foreach already uses a..b: as a series of discrete values.
