Function withBack

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

auto auto withBack(alias fun, Range) (
  Range range
)
if (from.std.range.isBidirectionalRange!Range);

Since

- 0.0.1

Example

import ddash.utils.optional: some, none;
assert((int[]).init.withBack!(a => a * a) == none);
assert([3, 2].withBack!(a => a * a) == some(4));
assert([3, 5].withBack!"a + 1" == some(6));