Automatic Foreach

janderson askme at me.com
Sun Apr 27 12:54:59 PDT 2008


Janice Caron wrote:
> On 27/04/2008, janderson <askme at me.com> wrote:
>> Janice Caron wrote:
>>
>>> Actually, I should have said that, in general, Joel's proposal is
>>> undefined for all non-unary operations.
>>>
>>>   a[] = b[] + c[]
>>>
>>>   f(a[], b[], c[], d[])
>>>
>>  My proposal was to generate nested loops and base it of the order the
>> arrays where specified. However it could just as easily be parallel for all
>> values and require that all arrays are the same size.
> 
> I think I'd be happy with a template in std.algorithm.
> 
>     // a[] = b[] + c[]
>     auto a = parallel!("a = b + c")(a,b,c);
> 
>     // foo(array1[], array2[], array3[], array4[])
>     parallel!("foo(a,b,c,d)")(array1,array2,array3,array4);
> 
> Or some such. I'm sure Andrei could write that. He's a clever guy.

I don't know.  Might as well use a foreach if its going to start looking 
like that.

-Joel



More information about the Digitalmars-d mailing list