-
-
Notifications
You must be signed in to change notification settings - Fork 112
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
clarify empty array expression #797
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested a more extensive subsection expanding on what was submitted.
src/reference-manual/expressions.qmd
Outdated
rep_array(0, 0) | ||
``` | ||
where the type of the first argument determines the type of the array | ||
(e.g., real or int). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The real and int should be escaped as real
and int
. (back ticks)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be worth pulling out a subsection and highlighting the empty array can be any type, not just a scalar.
Empty arrays {-}
The empty array expression ({ }
) is not allowed. See more about restrictions on array expressions in subsection Restrictions on values.
If needed, it is also possible to create an empty array with the expression
rep_array(e, 0)
where the first expression e
determines the type of the array. For example, rep_array(0.0, 0)
returns an empty real array of type real[]
, whereas rep_array({123}, 0)
returns an empty two dimensional integer array of type int[ , ]
. Only the type of the first argument is used, so the integer arrays {123}
and {0}
produce equivalent values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github shows the markdown in the comment so, that I can't see how many #
you used for the subsection "Empty arrays". Also I'm not certain where you would like to have that subsection.
Added also instruction how to create empty vectors and matrices |
Sorry about that---you can look at the source with the "edit" button. Three hashes. The only reason I pulled it out into a section is to make it more noticeable and better indexed by Google (though I'm not sure the indexing is helped much any more by level 3 headers---it used to be). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks.
Fixes #621
The restriction on empty array expression is mentioned later, but it is easy to miss, so clarified it now also earlier with link to the later section. Also added the suggested way to create an empty array.