On 2015-02-15 at 19:43, bearophile wrote:
void foo(in float[] data, in float[] xs, in float[] ys) @safe {
     iota(0, data.length, ys.length)
     .map!(xBase => iota(xBase, xBase + ys.length - 1)
                    .map!(y => [y, y+ys.length, y+ys.length+1, y+1])
                    .joiner)
     .joiner
     .writeln;
}

void main() {
     foo([1,2,3,4,5,6,7,8], [0.1,0.2], [10,20,30,40]);
}

Odd... Still something is wrong. It prints:
[0, 4, 5, 1, 1, 5, 6, 2, 2, 6, 7, 3, 4, 8, 9, 5, 5, 5, 6, 6, 6, 6, 7, 7]

instead of this:
[0, 4, 5, 1, 1, 5, 6, 2, 2, 6, 7, 3, 4, 8, 9, 5, 5, 9, 10, 6, 6, 10, 11, 7]

Reply via email to