The OpenD Programming Language

permutations

Lazily computes all permutations of r using Heap's algorithm.

While generating a new item is in O(k) (amortized O(1)), the number of permutations is |n|!.

  1. Permutations!T permutations(size_t n)
  2. IndexedRoR!(Permutations!T, Range) permutations(Range r)
    @safe pure nothrow
    permutations
    (
    T = uint
    Range
    )
    (
    Range r
    )
    if (
    __traits(compiles, Range.init[size_t.init])
    )

Parameters

r Range

random access field. A field may not have iteration primitivies.

Return Value

Type: IndexedRoR!(Permutations!T, Range)

Forward range, which yields the permutations

See Also

Meta