Ranges are a way of making lists that are arithmetic sequences of elements that can be enumerated. [1..20]
is the equivalent of writing [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
.
Letters can be enumerated too.
A step can be specified by adding an element after the first element.
To make a list with all the numbers from 20 to 1, you can’t just do [20..1]
, you have to do [20,19..1]
.
Be wary of floating point imprecision.
Infinite lists
Possible thanks to lazy evaluation.