Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent treatment of zero-length arrays in concatenation #41102

Closed
BioTurboNick opened this issue Jun 6, 2021 · 1 comment
Closed

Inconsistent treatment of zero-length arrays in concatenation #41102

BioTurboNick opened this issue Jun 6, 2021 · 1 comment

Comments

@BioTurboNick
Copy link
Contributor

Raised in #41047 and related to other concatenation consistency issues #38019 (mixed scalars and arrays) and #40111 (dimensionality of empty arrays returned by concatenation methods).

Concatenation of zero-length arrays does not behave consistently across methods.

[[] [] ; 4 5] => [4 5]

[[] [] 4 5] => DimensionMismatch("mismatch in dimension 1 (expected 0 got 1)")

[[]; []; 4; 5] => [4; 5]

[[]; 4 5] => ArgumentError: number of columns of each array must match (got (1, 2))

[[] []; 5] => ArgumentError: number of columns of each array must match (got (2, 1))

[[] 4 ; [] 5] => DimensionMismatch("mismatch in dimension 1 (expected 0 got 1)")

[4 []; [] 3] => DimensionMismatch("mismatch in dimension 1 (expected 1 got 0)")

[[] []; [] []] => 0×2 Matrix{Any}
@BioTurboNick
Copy link
Contributor Author

Looking more closely, I see it acts as if it is size == (0, 1, 1...), which is maybe a bit weird on the surface, but not actually inconsistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant