Module ddash.range.back
Provides methods for accessing the back of a range
Example
import std .algorithm: filter;
import std .range: iota, takeNone, array;
import ddash .utils: some, none;
auto evens = 10 .iota .filter!"a % 2 == 0" .array;
assert(evens .withBack!"a" == some(8));
assert(evens .takeNone .maybeBack == none);
assert(evens .takeNone .backOr(100) == 100);
Functions
Name | Description |
---|---|
backOr(range, defaultValue)
|
Retrieves the back of a range or a default value |
maybeBack(range)
|
Returns an Optional of the back of range
|
withBack(range)
|
Takes a unary function that is called on back of range if it is there |