Function withFront

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

auto auto withFront(alias fun, Range) (
  Range range
)
if (from.std.range.isInputRange!Range);

Since

- 0.0.1

Example

import ddash.utils.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));