Question: Newbie question about for loops

My sincere apologies for this incredibly elementary question.  I just can't find the answer.  Please refer me to an appropriate resource for this information if you know of one so that I won't bother the forum with such inane questions in the future.

Here is a simplfied example of what I'm trying to do (when my code didn't work, I created progressively simpler examples until I got to this):

--------------------------

a := array(1..3);

for i from 1 to 3 do

    a[i] := t -> i*t

end do;

--------------------------

Obviously, I expected to get this:

a[1] := t -> 1*t

a[2] := t -> 2*t

a[3] := t -> 3*t

 

Instead, however, I get this:

a[1] := t -> 4*t

a[2] := t -> 4*t

a[3] := t -> 4*t

 

I tried using eval on that second i, but to no avail.  Maple 11 was simply determined to delay evaluating that second i until the loop had ended.  I'm perplexed at why it will do the first i correctly, but not the second.

Thanks very much!

Please Wait...