The OpenD Programming Language

indexedRoR

Creates a projection of a generalized Collection range for the numeric case case starting from 0 onto a custom range of any type.

IndexedRoR!(Collection, Range)
indexedRoR
(
Collection
Range
)
(
Collection collection
,
Range range
)
if (
__traits(compiles, Range.init[size_t.init])
)

Parameters

collection Collection

range to be projected from

range Range

random access range to be projected to

Return Value

Type: IndexedRoR!(Collection, Range)

Range with a projection to range for every element of collection

Examples

import mir.ndslice.fuse;

auto perms = 2.permutations;
assert(perms.save.fuse == [[0, 1], [1, 0]]);

auto projection = perms.indexedRoR([1, 2]);
assert(projection.fuse == [[1, 2], [2, 1]]);
import mir.ndslice.fuse;
import std.string: representation;
// import mir.ndslice.topology: only;

auto projectionD = 2.permutations.indexedRoR("ab"d.representation);
assert(projectionD.fuse == [['a', 'b'], ['b', 'a']]);

// auto projectionC = 2.permutations.indexedRoR(only('a', 'b'));
// assert(projectionC.fuse == [['a', 'b'], ['b', 'a']]);

See Also

Meta