Prelude API
    Preparing search index...

    Function permutations

    • Creates a generator that yields all possible permutations of k elements from the source iterable. Permutations are returned as new arrays (safe copies).

      Type Parameters

      • T

      Parameters

      • Optionalk: number

        Optional number of elements to use in each permutation. If not provided, all elements are used.

      Returns (values: Iterable<T>) => Generator<T[]>

      A generator function that takes an iterable and yields all k-length permutations

      Arrays containing permutations of elements from the source iterable

      unsafePermutations for a variant that doesn't copy arrays (more efficient but mutates)