Lazy list/range comprehensions
bearophile
bearophileHUGS at lycos.com
Sun Oct 3 08:37:22 PDT 2010
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. 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
Bye,
bearophile
More information about the Digitalmars-d
mailing list