Skip to content

Dotdot notation

The following abbreviations are provided for denoting lists, of type [num], whose members form a finite or infinite arithmetic series. Let a',b', c stand for arbitrary numeric expressions.

    [a..b]     list of numbers from a to b inclusive, interval = 1
    [a..]      infinite list starting at a and increasing by 1
    [a,b..c]   arithmetic series, first member a, second member b,
            last member not greater than c (if b-a non-negative)
            or not less than c (if b-a negative).
    [a,b..]    infinite series starting at a, interval = (b-a)

So the notation [1..10] has as value the list [1,2,3,4,5,6,7,8,9,10]. Here are some more examples

    nats = [0..]
    evens = [0,2..]
    odds_less_than_100 = [1,3..99]
    neg_odds = [-1,-3..]
    tenths = [1.0,1.1 .. 2.0]