std-elt


Synopsis

(std-elt <lst> <i>)

Description

Returns the i'th element from the list or throws an index out of range error. The index is zero-based.

Safe NTH version with reverse order of arguments.

STD-ELT throws an index out of range error, which might be more appropriate for finding sources of errors. NTH throws just a bad argument type error.

Examples

(std-elt '(0 1) 0)         => 0
(std-elt lst -1)           => ERROR
(std-elt lst (length lst)) => ERROR

Arguments

lst: any list, including not proper lists

i: any integer which satisfies 0 <= i < (length lst)

Return Value

The specified element of the list.

Side Effects

None.

Module

(std-require 'STDLIST)

Defined in STDLIST