list head - part-cw/lambdanative GitHub Wiki
(list-head l k)
list-head return the first n elements of list. It is the opposite of list-tail.
Parameter | Description |
---|---|
l | The list to operate on |
k | Number of elements to keep |
Example
Example 1: Get first 3 and all but the first 3 elements of a 9 element list
> (define lst '(1 2 3 4 5 6 7 8 9))
> (list-head lst 3)
(1 2 3)
> (list-tail lst 3)
(4 5 6 7 8 9)