Arrays: Difference between revisions

Content added Content deleted
(Add Avail entry)
Line 6,653: Line 6,653:
The program could easily be modified to work with arrays of unknown length, if required, along the lines of the second pseudocode example above.
The program could easily be modified to work with arrays of unknown length, if required, along the lines of the second pseudocode example above.


=={{header|Standard ML}}==
<lang Standard ML>
(* create first array and assign elements *)
-val first = Array.tabulate (10,fn x=>x+10) ;
val first = fromList[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]: int array

(* assign to array 'second' *)
-val second=first ;
val second = fromList[10, 11, 12, 13, 14, 15, 16, 17, 18, 19]: int array

(* retrieve 5th element *)
-Array.sub(second,4);
val it = 14: int
</lang>
=={{header|Stata}}==
=={{header|Stata}}==
In Stata, there are mainly two ways to work with arrays: the '''[http://www.stata.com/help.cgi?matrix matrix]''' command can create and manipulate arrays, either elementwise or using matrix functions. And there is Mata, a matrix programming language similar to MATLAB, R or SAS/IML.
In Stata, there are mainly two ways to work with arrays: the '''[http://www.stata.com/help.cgi?matrix matrix]''' command can create and manipulate arrays, either elementwise or using matrix functions. And there is Mata, a matrix programming language similar to MATLAB, R or SAS/IML.