Super-dee-duper D features

Andrei Alexandrescu (See Website For Email) SeeWebsiteForEmail at erdani.org
Tue Feb 13 09:05:49 PST 2007


Frits van Bommel wrote:
> Andrei Alexandrescu (See Website For Email) wrote:
>> Bill Baxter wrote:
>>> Yeh, I don't get it either.  How would that help me implement merge() 
>>> from merge sort for instance?
>>
>> Merge bumps the iteration in both collections conditionally. The form 
>> above bumps the iteration in the two collections unconditionally, 
>> until one is finished; then it continues with the other until that is 
>> finished.
> 
> In other words, it doesn't :(.

A need for loops iterating over multiple collections depending on 
arbitrary conditions will always be there. The point of extending 
foreach is to address the often-encountered case when you want to 
iterate over multiple collections simultaneously (e.g.: copy a 
collection to another), just like foreach itself is addressing the 
particular but frequent case of iterating one collection in a linear manner.

Andrei



More information about the Digitalmars-d mailing list