http://d.puremagic.com/issues/show_bug.cgi?id=5756



--- Comment #5 from bearophile_h...@eml.cc 2011-09-29 15:06:38 PDT ---
An example of amap usage. This is input data:

auto data = ["1111100000",
             "1111000000",
             "1110000000",
             "1100001000",
             "1000010000",
             "0000100001",
             "0001000011",
             "0010000111",
             "0000001111",
             "0000011111"];

To convert it into a 2D matrix of booleans:

auto r = array(map!q{ array(map!q{ a == '1' }(a)) }(data));

The result r:

[[true, true, true, true, true, false, false, false, false, false], [true,
true, true, ...]]

Using amap the line of code becomes shorter and less noisy, almost readable:

auto r = amap!q{ amap!q{ a == '1' }(a) }(data);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to