Next: Table and array Up: New and enhanced Previous: Debugging facilities

Sequences and for loops

A new seq operator (for constructing sequences) has been added to the language. It has the same evaluation semantics as the Maple for loop and as such should be easier to use and understand than the dollar operator which it will eventually replace. There are two versions, modelled on the two kinds of for loops as indicated by the comments below.


    > s := seq( bernoulli(i), i=1..10 ); # for i to 10 do bernoulli(i) od;

             s := -1/2, 1/6, 0, -1/30, 0, 1/42, 0, -1/30, 0, 5/66


    > seq( abs(x), x=s ); # for x in s do abs(x) od;

                  1/2, 1/6, 0, 1/30, 0, 1/42, 0, 1/30, 0, 5/66


bondaren@thsun1.jinr.ru