withFront

Takes a unary function that is called on front of range if it is there

withFront
(
alias fun
Range
)
(
Range range
)
if (
from!"std.range".isInputRange!Range
)

Examples

import optional: some, none;
assert((int[]).init.withFront!(a => a * a) == none);
assert([3, 2].withFront!(a => a * a) == some(9));
assert([3, 2].withFront!"a + 1" == some(4));

Meta

Since

- 0.0.1