std-firstn


Synopsis

(std-firstn <n> <lst>)

Description

"list of first n elements"

STD-FIRSTN returns the first n elements of a list. It's the complement to STD-NTHCDR.

Exceptional Situations

If n is larger than the length of the list the lst argument is returned, if n is 0 or negative NIL is returned.

Examples

(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)

Arguments

n: an integer number.

lst: any proper list.

Return Value

A list.

Side Effects

None.

Module

(std-require 'STDLIST)

Defined in STDLIST