DMD 0.170 release
Knud Sørensen
12tkvvb02 at sneakemail.com
Sat Oct 28 17:41:25 PDT 2006
On Tue, 24 Oct 2006 08:42:13 -0700, Sean Kelly 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
>
This is very close to the vectorization syntax
http://www.all-technology.com/eigenpolls/dwishlist/index.php?it=10
x=[i in 0..length](if (vector[i]>5) return vector[i]);
[i in 0..length](vector[i]+=100);
maybe a slight change of notation.
x=[i in 0..length]{if (vector[i]>5) return vector[i]};
[i in 0..length]{vector[i]+=100};
> However, the second example above seems like it wouldn't work for an
> array of delegates, since this is a legal 'copy' syntax.
>
>
> Sean
More information about the Digitalmars-d-announce
mailing list