Getting Pieces of Lists
| First[list] | the first element in list |
| Last[list] | the last element |
| Part[list,n] or list[[n]] | the n element |
| Part[list,-n] or list[[-n]] | the n element from the end |
| Part[list,m;;n] | elements m through n |
| Part[list,{n1,n2,...}] or list[[{n1,n2,...}]] |
| the list of elements at positions , , ... |
Picking out elements of lists.
We will use this list for the examples.
| Out[1]= |  |
Here is the last element of

.
| Out[2]= |  |
This gives the third element.
| Out[3]= |  |
This gives the list of elements

through

.
| Out[4]= |  |
This gives a list of the first and fourth elements.
| Out[5]= |  |
| Take[list,n] | the first n elements in list |
| Take[list,-n] | the last n elements |
| Take[list,{m,n}] | elements m through n (inclusive) |
| Rest[list] | list with its first element dropped |
| Drop[list,n] | list with its first n elements dropped |
| Most[list] | list with its last element dropped |
| Drop[list,-n] | list with its last n elements dropped |
| Drop[list,{m,n}] | list with elements m through n dropped |
Picking out sequences in lists.
This gives the first three elements of the list

defined above.
| Out[6]= |  |
This gives the last three elements.
| Out[7]= |  |
This gives elements

through

inclusive.
| Out[8]= |  |
This gives elements

through

in steps of

.
| Out[9]= |  |
This gives

with the first element dropped.
| Out[10]= |  |
This gives

with its first three elements dropped.
| Out[11]= |  |
This gives

with only its third element dropped.
| Out[12]= |  |
"Manipulating Expressions like Lists" shows how all the functions here can be generalized to work not only on lists, but on any
Mathematica expressions.
The functions here allow you to pick out pieces that occur at particular positions in lists.
"Finding Expressions That Match a Pattern" shows how you can use functions like
Select and
Cases to pick out elements of lists based not on their positions, but instead on their properties.