std-firstn | ![]() |
"list of first n elements"
STD-FIRSTN
returns the first n elements of a list. It's the complement to STD-NTHCDR
.
If n is larger than the length of the list the lst argument is returned, if n is 0 or negative NIL is returned.
(std-firstn 2 '(0 1 2 3)) => (0 1) (std-nthcdr 2 '(0 1 2 3)) => (2 3) (std-firstn 0 '(0 1 2 3)) => nil (std-firstn -1 '(0 1 2 3)) => nil (std-firstn 5 '(0 1 2 3)) => (0 1 2 3)
n: an integer number.
lst: any proper list.
A list.
None.
(std-require 'STDLIST)
Defined in STDLIST