Multi-Dimensional Array Initialization

Can somebody please point me at the documentation for initializing multi-dimensional arrays?

No search pattern I feed to the web documentation finds anything.

Ages ago, I used to fish for this in the PDF of the specification? How do I rebuild the latest version of this?

Thanks - Damian

Hi Damian —

There is no multidimensional array literal / value syntax in Chapel currently, though there is agreement that we need this: Multidimensional array values (literals) · Issue #8864 · chapel-lang/chapel · GitHub. I think lack of syntax that anyone is too excited about is the main blocker currently, and then of course someone will have to implement it.

That's not to say that multidimensional arrays can't be initialized however, simply not with multidimensional array literals. E.g., here are some examples:

config const n = 9;

var A = [(i,j) in {1..n, 1..n}] if (i==j) then 1 else 0;
var B: [1..n, 1..n] real = [(i,j) in {1..n, 1..n}] i + j/10.0;

Ages ago, I used to fish for this in the PDF of the specification? How do I rebuild the latest version of this?

If you mean "How can I get the last version of the PDF-based spec?", that would be the version in 1.20 here: Chapel Language Specification — Chapel Documentation 1.20 (which also still seems to be snapshotted into our source tree here: https://github.com/chapel-lang/chapel/blob/main/doc/rst/language/chapelLanguageSpec.pdf

If instead you mean "How can I build a PDF version of today's spec?", unfortunately, that's not something we've continued to support since Remove tex spec by mppf · Pull Request #14303 · chapel-lang/chapel · GitHub. Note that the current spec is integrated into Chapel's general documentation search for better or worse ("better" being "you can search all the docs at once"; "worse" being "I'm not aware of a way to just search the spec and not the rest"), so using the general "search docs" query at the top-left of Chapel Documentation — Chapel Documentation 1.32 would be the way to search it today.

-Brad