Skip to content

Commit

Permalink
Add semantics of general subscripting.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Jul 7, 2023
1 parent a372b0b commit 0e9191c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chapters/arrays.tex
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ \section{Array Declarations}\label{array-declarations}
\item
Binding equations of the form \lstinline!x1 = x2! are allowed for arrays independent of whether the index types of dimensions are subtypes of \lstinline!Integer!, \lstinline!Boolean!, or enumeration types.
\end{itemize}
Operations constructing arrays (e.g., matrix multiplication, indexing, array constructors) only generate arrays index by \lstinline!Integer!.

% IMPROVETOP
\begin{table}[H]
Expand Down Expand Up @@ -946,6 +947,9 @@ \section{Indexing}\label{array-indexing}\label{indexing}
The number of dimensions of the expression is reduced by the number of scalar index arguments.
If the number of index arguments is smaller than the number of dimensions of the array, the trailing indices will use `\lstinline!:!'.

It is possible to index a general expression by enclosing it in parenthesis.
Note that the grammar is left factored and allows indexing of \lstinline[language=grammar]!output-expression-list!, but only indexing of an expression is syntactically valid.

It is also possible to use the array access operator to assign to element/elements of an array in algorithm sections.
This is called an \firstuse[assignment statement!indexed]{indexed assignment statement}.
If the index is an array the assignments take place in the order given by the index array.
Expand Down

0 comments on commit 0e9191c

Please sign in to comment.