apply

Create Range of Elements Generated by fun.

Use for example to generate random instances of return value of fun.

TODO I believe we need arityMin, arityMax trait here

apply
(
alias fun
N
)
(
N n
)
if (
arityMin0!fun &&
!is(ReturnType!fun == void)
&&
isIntegral!N
)

Examples

import std.datetime: Clock, SysTime, Duration;
import std.algorithm.iteration: map;
import std.array: array;
immutable n = 3;
auto times = n.apply!(Clock.currTime).array;
version(print) dbg(times);
auto spans = times.forwardDifference;
version(print) dbg(spans);

Meta