dalicious.algorithm.iteration

Some additional alogorithm functions.

Members

Aliases

charRange
alias charRange = map!"cast(const char) a"

Cast elements to const(char).

Functions

backtracking
T[] backtracking(T[] candidates, T[] solution)

Find an optimal solution using backtracking.

filterInPlace
Array filterInPlace(Array array)

Returns array filtered in-place.

first
ElementType!Range first(Range range)

Get the first element in range assuming it to be non-empty.

last
ElementType!Range last(Range range)

Get the last element in range assuming it to be non-empty.

replaceInPlace
Array replaceInPlace(Array array, E needle, E replacement)

Replaces the first occurrence of needle by replacement in array if present. Modifies array.

sliceBy
auto sliceBy(Array array)

Slices an input array into slices of equivalent adjacent elements. In other languages this is often called partitionBy, groupBy or sliceWhen.

sliceUntil
Array sliceUntil(Array haystack, Needle needle, OpenRight openRight)
Array sliceUntil(Array haystack, OpenRight openRight)

Return the prefix of haystack where pred is not satisfied.

uniqInPlace
Array uniqInPlace(Array array)

Returns array uniqified in-place.

Meta

License

Subject to the terms of the MIT license, as written in the included LICENSE file.

Authors

Arne Ludwig <arne.ludwig@posteo.de>