Range Construction Pattern

Tobias Pankrath tobias at pankrath.net
Sat Feb 22 04:40:40 PST 2014


On Saturday, 22 February 2014 at 12:29:11 UTC, Nordlöw wrote:
> Assumed I have the following code
>
>     SysTime[] times;
>     const n = 3;
>     foreach (i; 0..n) times ~= Clock.currTime;
>
> is there a simpler, perhaps functional, higher order pattern 
> with which to achieve the same goal?

What's Clock.currTime exactly, a function?
--
times = iota(3).map!(x => Clock.currTime).array;
--



More information about the Digitalmars-d-learn mailing list