The OpenD Programming Language

retro

Reverses order of iteration for all dimensions.

  1. auto retro(Slice!(Iterator, N, kind) slice)
  2. auto retro(T[] array)
  3. auto retro(T withAsSlice)
  4. auto retro(Range r)
    retro
    (
    Range
    )
    (
    Range r
    )
    if (
    !hasAsSlice!Range &&
    !isSlice!Range
    &&
    !is(Range : T[],
    T
    )
    )

Return Value

Type: auto

Slice/range with reversed order of iteration for all dimensions.

Examples

auto slice = iota(2, 3);
static immutable reversed = [[5, 4, 3], [2, 1, 0]];
assert(slice.retro == reversed);
assert(slice.canonical.retro == reversed);
assert(slice.universal.retro == reversed);

static assert(is(typeof(slice.retro.retro) == typeof(slice)));
static assert(is(typeof(slice.canonical.retro.retro) == typeof(slice.canonical)));
static assert(is(typeof(slice.universal.retro) == typeof(slice.universal)));

Ranges

import mir.algorithm.iteration: equal;
import std.range: std_iota = iota;

assert(std_iota(4).retro.equal(iota(4).retro));
static assert(is(typeof(std_iota(4).retro.retro) == typeof(std_iota(4))));

See Also

Meta