Difference between revisions of "Row"

From Mesham
Jump to navigationJump to search
(Created page with ' == Syntax == row[ ] == Semantics == In combination with the array, the programmer can specify whether allocation is row or column major. This allocation information is provid…')
 
m (5 revisions imported)
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
 
== Syntax ==
 
== Syntax ==
  
Line 6: Line 5:
 
== Semantics ==
 
== Semantics ==
  
In combination with the array, the programmer can specify whether allocation is row or column major. This allocation information is provided in the allocation type.
+
In combination with the array, the programmer can specify whether allocation is row or column major. This allocation information is provided in the allocation type. In row major allocation the first dimension is the most major and the last most minor.
  
 
== Example ==
 
== Example ==
  
  var a:array[Int,10,20] :: allocated[col[] :: multiple[]];
+
  function void main() {
((a#1)#2):=23;
+
    var a:array[Int,10,20] :: allocated[col[] :: multiple[]];
(((a :: row[])#1)#2):=23;
+
    a[1][2]:=23;
 +
    (a :: row)[1][2]:=23;
 +
};
  
 
Where the array is column major allocation, but the programmer has overridden this (just for the assignment) in line 3. If one array of allocation copies to another array of different allocation then transposition will be performed automatically in order to preserve indexes.  
 
Where the array is column major allocation, but the programmer has overridden this (just for the assignment) in line 3. If one array of allocation copies to another array of different allocation then transposition will be performed automatically in order to preserve indexes.  
 +
 +
''Since: Version 0.41b''
  
 
[[Category:Type Library]]
 
[[Category:Type Library]]
[[Category:Composite Types]]
+
[[Category:Compound Types]]
 
[[Category:Collection Types]]
 
[[Category:Collection Types]]

Latest revision as of 15:44, 15 April 2019

Syntax

row[ ]

Semantics

In combination with the array, the programmer can specify whether allocation is row or column major. This allocation information is provided in the allocation type. In row major allocation the first dimension is the most major and the last most minor.

Example

function void main() {
   var a:array[Int,10,20] :: allocated[col[] :: multiple[]];
   a[1][2]:=23;
   (a :: row)[1][2]:=23;
};

Where the array is column major allocation, but the programmer has overridden this (just for the assignment) in line 3. If one array of allocation copies to another array of different allocation then transposition will be performed automatically in order to preserve indexes.

Since: Version 0.41b