docs
docs copied to clipboard
length 0 array documentation
This issue stems from https://github.com/stan-dev/stanc3/issues/1286 where there was some confusion on length 0 arrays. It becomes apparent that there is ambiguity in the type of the array with length 0. I think we should add documentation around this and state clearly that {} is not a valid constructor.
I believe the relevant section that can be expanded is in the reference manual at https://mc-stan.org/docs/reference-manual/vector-matrix-array-expressions.html#array-expressions.
Thanks for posting the issue, @spinkney. We should definitely fix this.
I believe this is stated further down on the page you link, https://mc-stan.org/docs/reference-manual/vector-matrix-array-expressions.html#no-empty-array-expressions
Ah, very nice!
Is there anything more you think we should be saying in that section?
Is there anything more you think we should be saying in that section?
I think I would've noticed this better if it was in the part Rectangular array expressions only instead of it's own section. Though this could just be how I read sections, finding the relevant part and then switching back to what I'm doing, instead of reading through the docs carefully.
The only other thing to add is @nhuurre's suggestion that it is also possible to create empty array's on the fly as rep_array({1.0}, 0).