chickadee » srfi-1 » take

take x iprocedure
drop x iprocedure

take returns the first I elements of list X. drop returns all but the first I elements of list X.

(take '(a b c d e)  2) => (a b)
(drop '(a b c d e)  2) => (c d e)

X may be any value -- a proper, circular, or dotted list:

(take '(1 2 3 . d) 2) => (1 2)
(drop '(1 2 3 . d) 2) => (3 . d)
(take '(1 2 3 . d) 3) => (1 2 3)
(drop '(1 2 3 . d) 3) => d

For a legal I, take and drop partition the list in a manner which can be inverted with append:

(append (take X I) (drop X I)) = X

drop is exactly equivalent to performing I cdr operations on X; the returned value shares a common tail with X. If the argument is a list of non-zero length, take is guaranteed to return a freshly-allocated list, even in the case where the entire list is taken, e.g. (take lis (length lis)).