Stupid little iota of an idea

Don nospam at nospam.com
Fri Feb 18 13:10:37 PST 2011


Nick Sabalausky wrote:
> "bearophile" <bearophileHUGS at lycos.com> wrote in message 
> news:ij473k$1tfn$1 at digitalmars.com...
>> 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.

I don't like interval at all, because I don't think it includes the 
notion of 'stepping'. An interval is just, everything from A to B, 
without necessarily specifying how you reach everything in that 
interval. Whereas iota includes the stepping.
(I would like to see intervals in the language, but just as an [a,b] pair).

OTOH iota() is unintuitive to me, and I do keep reading it as itoa().
Sadly I don't have any better suggestions.


More information about the Digitalmars-d mailing list