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

    Function transpose

    • Transposes the rows and columns. Passing an infinite list will hang forever.

      Type Parameters

      • T

      Parameters

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

      The transposed list.

      Examples

      const matrix = fromArray([fromArray([1, 2, 3]), fromArray([4, 5, 6])]);
      const transposed = transpose(matrix);
      const actual = toArray(transposed).map((col) => toArray(col));
      expect(actual).toStrictEqual([
      [1, 4],
      [2, 5],
      [3, 6],
      ]);