DMD 0.170 release

Chris Nicholson-Sauls ibisbasenji at gmail.com
Thu Oct 26 12:35:21 PDT 2006


Bruno Medeiros wrote:
> Sean Kelly wrote:
> 
>> Bruno Medeiros wrote:
>>
>>>
>>> Scrap that, duh. Non-ordered 'iteration' is, kinda like you said, 
>>> without breaks or gotos, and thus applied to all elements. So one can 
>>> use regular functions with delegate parameters to do this 
>>> 'iteration'. These non-ordered, complete 'iterations' are actually 
>>> the list/collection 'comprehensions' 
>>> (http://www.digitalmars.com/d/archives/digitalmars/D/39313.html , 
>>> which we knew already, but didn't remember?) which are very easy to 
>>> parallelize (think Google MapReduce). Doesn't this solve the issue, 
>>> in quite cleaner syntax and semantics?
>>
>>
>> It's a cool idea:
>>
>> x = vector[ (int t){return t>5;} ]; // subset of vector
>> vector[] = (inout int x) { x += 100; }; // update all members of vector
>>
>> However, the second example above seems like it wouldn't work for an 
>> array of delegates, since this is a legal 'copy' syntax.
>>
>>
>> Sean
> 
> 
> Do you have something against methods?... :p
> 
> x = vector.filter( (int t){return t>5;} ); // subset of vector
> vector.apply( (inout int x) { x += 100;} ); // update all members
> 
> 

Looks good to me.  I do have .filter implemented in CashewUtils, and might just add a 
.apply now that you mention it.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d-announce mailing list