@mikuroxina/mini-fn
    Preparing search index...

    Function choices

    • Creates a list such that whenever v_i has finite index in list i for each i, [v_1, v_2, ..., v_n] has finite index in the output list. It is different to cartesian product, so the order of elements are not sorted.

      Type Parameters

      • T

      Parameters

      Returns List.List<List.List<T>>

      The choose list.

      Examples

      const choice = choices(fromArray([range(0, 3), range(3, 6)]));
      const sequences = toArray(choice).map((seq) => toArray(seq));
      expect(sequences).toStrictEqual([
      [0, 3],
      [0, 4],
      [1, 3],
      [0, 5],
      [1, 4],
      [2, 3],
      [1, 5],
      [2, 4],
      [2, 5],
      ]);