Skip to content
Chris Petersen edited this page Oct 16, 2014 · 1 revision

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)
Clone this wiki locally