Stupid little iota of an idea

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Fri Feb 18 15:02:50 PST 2011


On Fri, 18 Feb 2011 22:10:37 +0100, Don wrote:

> Nick Sabalausky wrote:
>> 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.

I have a similar range in SciD, which is called steps().  It differs from 
iota() in that a) you specify the number of steps instead of the step 
size and b) it only iterates over FP numbers and ensures that the first 
and last iterated values are in fact exactly the endpoints you specify.

I guess steps() would be a possible name for iota(), but then I would 
have to come up with a new name for my range. ;)

-Lars


More information about the Digitalmars-d mailing list