Question: Initializing a list of given size in Maple

I am required to generate a list containing the square of numbers 1 through k where k is an arbitrary int,defined from 1 to n. To do this, I've currently got the following commands:

local k, mylist:=[];

for k from 1 to n do

mylist[k]=sumsquare(k);

end do;

where sumsquare() is a procedure I defined to compute the sum of the squares of 1 through a number passed as an argument

At present this gives me an out of bounds error. 

How can I initialize mylist to be of size n, like in other languages such as C++?

 

Please Wait...