ranges.chunks and map! does not work

Alex sascha.orlov at gmail.com
Thu Jul 5 11:15:31 UTC 2018


On Thursday, 5 July 2018 at 09:47:32 UTC, Andre Pany wrote:
> Is it correct that I need to call ".map!(c => c.array)"?
>
> Kind regards
> André

Well, no. It depends on how you define the formatting string. 
This would also work:

´´´
import std.experimental.all;

void main()
{
     double[] timestamps = [1.1];
     double[] temperatures = [2.2];
     double[] pressures = [3.3];

     string content = roundRobin(timestamps, temperatures, 
pressures)
         .chunks(3)
         //.map!(c => c.array)
         .map!(c => "%(%g,%)".format(c))
         .join("\n");

     writeln(content);
}
´´´


More information about the Digitalmars-d-learn mailing list