monarch_dodra:

So my vote goes to this solution.

//----
uint[] foo3(in uint[][] X)
{
    assert(!X.empty)
    auto seed = X.front.dup;
    X.popFront();
    return reduce!((i, j) => zip(i, j)
                             .map!(kw => kw[0] | kw[1])
                             .array)
                  (seed, X);
}
//----

I re-wrote it that way: It's a bit longer, but a bit more generic in terms of customizing your seed.

OK, thank you. So the price for that "in" is to use a dup :-) (Or use lower level code).

Bye,
bearophile

Reply via email to