Not clever enough to expand like this though:
map!( (a, b) => a+b )( zip(Range1, Range2) );

Using a => a[0]+a[1] is not that big deal though.

On Saturday, 29 December 2012 at 17:58:55 UTC, Ali Çehreli wrote:
On 12/29/2012 06:19 AM, Simen Kjaeraas wrote:

> foreach (a; zip(A, B) ) {
> // Use a[0] and a[1] here.
> }
>
> There have been suggestions to better integrate tuples in the
language,
> so in the future zip may have all the advantages of lockstep
(and vice
> versa), but don't cross your fingers.

Tuples have already been integrated at least as much: :)

import std.stdio;
import std.range;

void main()
{
    int[] cats;
    int[] birds;

    foreach (cat, bird; zip(cats, birds)) {
        writeln(cat, bird);
    }
}

Ali

Reply via email to