5.40.6 The left and right portions of a list: left right
The left and right can find the left and right parts
of a list. (See Section 5.3.4, Section 5.15.3,
Section 5.37.1, Section 5.38.2,
Section 5.55.4 and Section 5.55.5 for
other uses of left and right.)
- left takes two arguments:
- L, a list.
- n, a positive integer.
- left(L,n) returns the first n elements of L.
Example
Input:
left([0,1,2,3,4,5,6,7,8],3)
Output:
- right takes two arguments:
- L, a list.
- n, a positive integer.
- right(L,n) returns the last n elements of L.
Example
Input:
right([0,1,2,3,4,5,6,7,8],4)
Output: