generate

fnauto generate(Fun)(Fun fun) if (isCallable!fun)

Given callable (isCallable) fun, create as a range whose front is defined by successive calls to fun(). This is especially useful to call function with global side effects (random functions), or to create ranges expressed as a single delegate, rather than an entire front/popFront/empty structure. fun maybe be passed either a template alias parameter (existing function, delegate, struct type defining static opCall) or a run-time value argument (delegate, function object). The result range models an InputRange (isInputRange). The resulting range will call fun() on construction, and every call to popFront, and the cached value will be returned when front is called.

Returns

an inputRange where each element represents another call to fun.
fnauto generate(alias fun)() if (isCallable!fun)

ditto