std-select


Synopsis

(std-select <lst> <i>|<list-of-i>)

Description

It works like std-elt or nth but allows the access of multiple elements also like std-subseq.

If i is an integer it works exactly the same as STD-ELT.

If i is a list of integers the indices are gathered in the order as specified in i and the resulting list of elements is returned.

This is similar to the xlisp extension select.

STD-SELECT throws an index out of range error, which might be more appropriate for finding sources of errors.

Examples

(std-select '(a b c d) 0)       => A
(std-select '(a b c d) '(1 0)   => (B A)
(std-select '(a b c d) '(1 0 4) => ERROR

Arguments

lst: any list, including not proper lists

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

list-of-i: list of integers which satisfies 0 <= i < (length lst)

Return Value

The specified element(-s) of the list.

Side Effects

None.

Module

(std-require 'STDLIST)

Defined in STDLIST