Arrays: Difference between revisions

Added Maple implementation.
m (added another link to ;Related tasks: section.)
(Added Maple implementation.)
Line 3,136:
l[l] = l -- Again, any object can be used as an index. Even other tables
for i,v in next,l do print (i,v) end</lang>
 
=={{header|Maple}}==
<lang maple>#defining an array of a certain length
a := Array (1..5);
a := [ 0 0 0 0 0 ]
#can also define with a list of entries
a := Array ([1, 2, 3, 4, 5]);
a := [ 1 2 3 4 5 ]
a[1] := 9;
a
a[1] := 9
[ 9 2 3 4 5 ]
a[5];
5
#can only grow arrays using ()
a(6) := 6;
a := [ 9 2 3 4 5 6 ]
a[7] := 7;
Error, Array index out of range</lang>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==