Written by So8res last updated

A list is an ordered collection of objects, such as [0, 1, 2, 3] or ["red", "blue", 0, "shoe"]. Lists are generally denoted by square brackets, with elements separated by commas. Lists allow repetition (unlike sets) and are ordered (unlike bags).

Sometimes lists are typed, in which case they contain only one type of element. For example, [0, 1, 2, 3] is a well-typed list of numbers, whereas the list ["red", "blue", 0, "shoe"] is not well-typed (because it contains both numbers and strings). The set of all lists of type is usually denoted or , where is the smallest infinite limit ordinal. The set of all finite lists of type is usually denoted , and the set of all infinite lists of type is usually denoted .