Lazy list/range comprehensions

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Oct 3 10:59:12 PDT 2010


On 10/03/2010 10:37 AM, bearophile wrote:
> Peter Alexander:
>
>> Out of curiosity, what syntax did you propose?
>
> http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=73868
>
>
>
>> That said, the current D way of writing it isn't all that different
>> from Python:
>>
>> return reduce!("a+b")(map!("a*a")(sequence), 0);
>
> That's many times worse than the Python syntax.

This entails there's a way to measure that. How?

> Array/range comprehensions are syntax sugar, their point is to give
> something clean and readable that helps chunking:
> http://en.wikipedia.org/wiki/Chunking_%28psychology%29

You'd need to bring a pointer to a document that confirms that (and how) 
array and range comprehensions have helping chunking as their point. I 
googled for

array comprehensions help chunking

to no avail.


Andrei


More information about the Digitalmars-d mailing list