Enhancing foreach

Jonathan M Davis jmdavisProg at gmx.com
Wed Jan 9 18:27:18 PST 2013


On Thursday, January 10, 2013 03:19:51 bearophile wrote:
> In my code iota() is common, even if it's surely not as common as
> range() in Python. I think it's common enough that you remember
> that iota(5) is a range of five items. And D too is 0-based. (and
> iota in APL accepted one argument).

I almost never use iota. It's useful upon occasion, but in my experience, it's 
_far_ more common to iterate over ranges of items rather than just over a list 
of numbers. Clearly, you're doing things very differently than I am if you use 
iota that much. Regardless, I don't think that loss to clarity is worth the 
characters saved when providing only one argument to iota.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list