Mixin and map
Dennis Ritchie via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Apr 5 14:23:12 PDT 2015
Hi,
Can you please tell how to make map worked correctly. I want to
program published [2, 3, 4, 5, 6].
-----
import std.stdio;
import std.algorithm;
string print(string s)
{
return `writeln(` ~ s ~ `);`;
}
void main()
{
auto arr = [1, 2, 3, 4, 5];
mixin(print(`arr.map!(t => t++)`)); // prints [1, 2, 3, 4, 5]
}
-----
http://ideone.com/yEmzA4
More information about the Digitalmars-d-learn
mailing list