Can't pass data from filter to each

Suliman via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Apr 17 02:16:41 PDT 2017


I am writing lambda function. I need filter data at first step 
and than do dome operation on them (for start simply print on the 
screen. I wrote next code:

MySQLTablesRange.filter!(a=>a[0].coerce!string.canFind("_")).each!(a => to!int(a[0].coerce!string.split("_")[1]).writeln);


But it's seem that each do not handle any data. I tested if data 
is corectly filtered and next code successfully print it's output.

auto t = 
MySQLTablesRange.array.filter!(a=>a[0].coerce!string.canFind("_"));
t.each!(a=>a[0].coerce!string.writeln);

But what is wrong with first code?


More information about the Digitalmars-d-learn mailing list