F# how to append/join array2D and combine 1D arrays to array2D

前端 未结 3 1826
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-18 08:40

in F#, array.append can join two arrays; is there a way to append 2 array2D objects into one or column-wise join several 1-D arrays into one array2D object?

3条回答
  •  不思量自难忘°
    2021-01-18 08:51

    I don't think there's anything built-in to handle this. You can define your own reusable method based on either Array2D.init or Array2D.blit, though. If you need to combine several columns into one logical whole, I think it would frequently be more convenient to use an array of arrays rather than a 2D array (and in general, the 1D array operations in .NET are significantly faster than the multi-dimensional array operations).

提交回复
热议问题