Questaal Home
Navigation

Syntax of integer lists


Integer lists consist of a sequence of strings separated by commas:

       strn1,strn2,...

Each of the   strn1, strn2, …   can assume one of the following three forms:

  1. a single integer or algebraic expression

  2. two integer expressions separated by a colon, viz

    low:high
    

    gets expanded into

    low, low+1, low+2, ... high
    
  3. Three integer expressions separated by colons, viz

    low:high:step
    

    gets expanded into:

    low, low+step, low+2*step, ... high
    
  4. (Extension, not always applicable). The dup tag:

    dup=#
    

    duplicates the entire list to this point, and  #  is added to the duplicate elements. The list up to the current point doubles in size. dup can appear anywhere in the list.

  5. (Extension, not always applicable). The seq tag

    seq=#
    

    can be appended to the list. seq=# replicates the existing list, shifting each element in the new list by a constant that makes the first element  #. The size of the list doubles.

    #  itself can a single number or an integer list. If it is a list of n elements, the original list is replicated n times.
    Each replication is shifted by a constant so that the first element is the current element in  #. The final list is then n+1 - fold larger in size than the original list.

Examples

  5+1             becomes a single number, 6.
  5+1:8+2         becomes a sequence of numbers, 6 7 8 9 10
  5+1:8+2:2       becomes a sequence of numbers, 6 8 10
  1:4,7:11        becomes the sequence 1 2 3 4  7 8 9 10 11

  5,6,dup=16,8    becomes the sequence 5 6  21 22  8

  5,6,8,seq=9     becomes the sequence 5 6 8  14 15 17
  7:9:2,seq=9,18  becomes the sequence 7 9  16 18  25 27

Note:  slatsm/mkilst.f contains the source code for generating integer lists.
Edit This Page