std-butlast


Synopsis

(std-butlast <lst>)

Description

std-butlast returns the list without the last element, the complement to cdr.

It is not the same as (std-remove (last lst) lst), which would remove all elements that are equal to the last (all possible duplicates also), but equal to
(std-delpos (1- (length lst)) lst) only implemented more efficiently.

Exceptional Situations

(std-butlast nil) returns nil.

On not list arguments a bad argument type error is thrown.

Examples

(std-butlast '(0 1 2 3)) 	=> (0 1 2)
(std-butlast '(0)) 	=> nil
(std-butlast nil) 	=> nil

Arguments

lst: any proper list.

Return Value

A list.

Side Effects

None.

Module

(std-require 'STDLIST)

Defined in STDLIST