part function
Read part of a list by position, counting from 1; also written list[i].
How to write it
part(list, i)
One element.
- list
- The list. Takes a list.
- i
- The position. Takes a whole number.
part(list, i, j)
An element of a list of lists.
- list
- A list of lists. Takes a list.
- i
- The row. Takes a whole number.
- j
- The column. Takes a whole number.
Examples
part([10, 20, 30], 2)In the solver,
Open in the solverpart([10, 20, 30], 2)gives20.part([[1, 2], [3, 4]], 2, 1)In the solver,
Open in the solverpart([[1, 2], [3, 4]], 2, 1)gives3.
Related functions
- replace_part
A list with the part at a position replaced; write position -> value.
- partition
A list split into blocks of a given length.
- nest_list
The steps of nest: the value after each application, starting from the first.
- position
Where a value occurs in a list, as a list of positions.
- nest
Apply a function again and again to a value.
- prepend
A list with an element added at the start.