How to apply a function to a container/array ?
Domingo via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Oct 15 18:00:42 PDT 2014
Thanks so much it's a bit more bloated than I was expecting but
it works.
-------
void main() {
import std.stdio;
import std.algorithm;
import std.array;
import std.string;
import std.conv;
auto ar = [" dad ", " blue "];
ar.writeln;
auto arStriped = ar.map!strip.array;
arStriped.writeln;
alias stringize = map!text;
auto sz = stringize([ 1, 2, 3, 4 ]);
assert(sz.equal(["1", "2", "3", "4"]));
}
--------
More information about the Digitalmars-d-learn
mailing list