Hi
What am I doing wrong here?

import std.stdio, std.range, std.algorithm, std.uni, std.utf, std.conv, std.typecons, std.array;

auto SE(A, B)(in A a, in B b){
    return (a-b)^^2;
}

void main(){
    auto a = [1, 2, 3], b = [1, 1, 1];
lockstep(a, b, StoppingPolicy.requireSameLength).each!((a, b){ writeln(SE(a, b)); }); lockstep(a, b, StoppingPolicy.requireSameLength).map !((a, b){ return SE(a, b) ; }).each!writeln; <- error here
}

The error:
map(Range)(Range r)
  with Range = Lockstep!(int[], int[])
  must satisfy the following constraint:
       isInputRange!(Unqual!Range)

Why it works with each (or foreach), but not with map? o.O

I just wanted to make a Sum of squared errors function.

Thanks in advance!

Reply via email to