join of range of ranges?
bearophile
bearophileHUGS at lycos.com
Sun Sep 22 07:26:12 PDT 2013
In some cases I'd like to join a range of ranges in a single
array/string (I know here the inner map could be replaced by
something better, this code is just an example):
import std.algorithm: map;
import std.array: join, array;
void main() {
auto r1 = [1, 2]
.map!(x => [1, 2].map!(y => '*').array)
.join("_");
auto r2 = [1, 2]
.map!(x => [1, 2].map!(y => '*'))
.join("_");
}
The code works only if I add an 'array' inside, to turn it into a
range of arrays. Do you think it's right to ask as enhancement
for std.array.join to work with a range of ranges too, as in the
r2 case?
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list