## Lists

Lists are an ordered collection of expressions separated by commas and surrounded by a pair of square brackets.

Elements of a list can be accessed by assigning the list to a variable. Lists are 1-indexed meaning the first element starts at index 1.

Lists elements in a variable can be accessed using an integer, range or a list of integers.

[1, 2, 3, 4, 5]
1:10
@[10]

## Accessing elements in a list

a=[10, 20, 30] a(1)
a=[10, 20, 30] a(1)+a(2)+a(3)

## Accessing elements in a list using a range

a=[1, 2, 3, 4, 5, 6, 7, 8, 9] a(2..5)
a=[1, 2, 3, 4, 5, 6, 7, 8, 9] a(1..\$ -> 2)

## Accessing elements in a list using another list

primes=[2, 3, 5, 7, 11, 13, 17, 19, 23] primes([2, 5])

## Accessing elements from the end using the index and size operators

a=[1, 2, 3, 4, 5, 6, 7, 8, 9] a(#\$)
a=[1, 2, 3, 4, 5, 6, 7, 8, 9] a(#\$ - 1)

## Combining lists using the transformation operator

[1, 2, 3, 4] -> [5, 6]

## Sublists using the transformation operator

[1, 2, 3, 4, 5, 6, 7, 8, 9] -> 2..5
[1, 2, 3, 4, 5, 6, 7, 8, 9] -> 6..\$
[1, 2, 3, 4, 5, 6, 7, 8, 9] -> (1..\$ -> 2)

## Deleting elements in a list using the index operator

[1, 2, 3, 4, 5, 6, 7, 8, 9] -> #2..5
[1, 2, 3, 4, 5, 6, 7, 8, 9] -> #6..\$