# Lists

Lists of numbers or points are used as parameters for some GeoGebra commands. Apart from this, it is possible to make lists of general GeoGebra objects. Whenever several objects depend on an index, it is possible to construct them using a list. If a worksheet contains very many objects, it may be slow. Using lists instead of individual objects, will usually make a worksheet faster.

If the objects have already been constructed, you can use the "Create List" tool, to make a list.

When using the "Create List" tool on objects that are not points, the values of the objects are inserted in the list, not the objects themselves. The tool is mainly useful for points or numbers. To make a list of actual objects, the definition of the objects are used. Use curly brackets:

	list2={Circle[A, B], Polygon[C, D, 4], Polygon[G, H, 3]}


All objects in a list have the same visual properties, they must all have the same colour.

To make a list of objects that follow some regular pattern, the Sequence-command is used. There are several ways to use this command:

  list1=Sequence[ <End Value> ]
list2=Sequence[ <Expression>, <Variable>, <Start Value>, <End Value> ]
list3=Sequence[ <Expression>, <Variable>, <Start Value>, <End Value>, <Increment> ]


Try out Sequence[5]!

As a first example, the example "From trace to spreadsheet" on the side GeoGebra Tutorial - Spreadsheet is used.

Instead of using the spreadsheet, 100 lines can be created by using the command:

	l1=Sequence[PerpendicularBisector[A, (0, i)], i, 0, 99]


In this example, only one list is used. It is also possible to make lists that depend on elements in other lists.

## Using elements in lists

The elements of a list in GeoGebra are ordered such that the first element has index one. This is not the conventional way of doing it, in most programming languages the first element has the index zero. In order to get the n:th element of a list, the command Element is used:

	ele=Element[ <List>, <Position of Element> ]


As a demonstration, the example "Many transformations" from GeoGebra Tutorial - Symmetries will be used.

Enter three points A, B, C, and a slider n taking integer values between 2 and 20.

Make a list of rotated triangles by entering the command:

  l1=Sequence[Polygon[Rotate[A, i 2 pi / n], Rotate[B, i 2 pi / n],
Rotate[C, i 2 pi / n]], i, 1, n]


Make a list of reflected triangles by entering the command:

  l2=Sequence[Reflect[Element[l1, i], yAxis], i, 1, n]


Enter a vector u and make two lists of translated triangles:

  l3=Sequence[Translate[Element[l1, i], u], i, 1, n]
l4=Sequence[Translate[Element[l2, i], u], i, 1, n]


The visual properties of each list can be change. The result is shown in the topmost applet.