DMD 0.170 release

Bruno Medeiros brunodomedeiros+spam at com.gmail
Thu Oct 26 12:08:09 PDT 2006


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


-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D



More information about the Digitalmars-d-announce mailing list