CSBiology / FSharpAux

Auxiliary functions and data structures for the F# programming language
MIT License
23 stars 16 forks source link

Inproper exception when `JaggedArray`/`JaggedList.transpose` is used on arrays/lists with different lengths #33

Open omaus opened 1 year ago

omaus commented 1 year ago

Description

When calling JaggedArray.transpose or JaggedList.transpose on arrays resp. lists with differently long arrays/lists inside, an exception is thrown. But this exception does not help detect the problem in a, say, long pipeline.

Repro steps

  1. Run this exemplary code snippet:
    JaggedList.transpose [[1;2;3]; [4;5]]
    JaggedArray.transpose [|[|1;2;3|]; [|4;5|]|]
  2. See errors.

Expected behavior

Throws an exception that tells the user that array/list elements are varying in length.

Actual behavior

Throws following exceptions: System.ArgumentException: The input list was empty. (Parameter 'list'), resp. System.IndexOutOfRangeException: Index was outside the bounds of the array..