Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fathym_common/deps.ts>permutations

The Fathym Reference Architecture provides the common foundation for applications built in Typescript.
Go to Latest
function permutations
import { permutations } from "https://deno.land/x/fathym_common@v0.0.184/deps.ts";

Builds all possible orders of all elements in the given array Ignores equality of elements, meaning this will always return the same number of permutations for a given length of input.

Examples

Example 1

import { permutations } from "https://deno.land/std@0.224.0/collections/permutations.ts";
import { assertEquals } from "https://deno.land/std@0.224.0/assert/assert_equals.ts";

const numbers = [ 1, 2 ];
const windows = permutations(numbers);

assertEquals(windows, [
  [ 1, 2 ],
  [ 2, 1 ],
]);

Parameters

inputArray: Iterable<T>