take
get the first n items from a list
(list xs, long n) -> list
Returns a list containing the first n
elements of xs
. Returns xs
if n
is greater than the size of xs
.
Returns an empty list if n
is negative.
Returns nil
if xs
is nil
or n
is nil
.
Parameters
Name | Type | Description |
---|---|---|
xs |
list | The list to work with |
n |
long | The number of elements to include in the result |