![]() | ![]() | ![]() | sole-element | ![]() |
| list
nil | [Function] |
Purpose
Return the first element of a list containing, at most, one element.
Package :gbbopen-tools
Module :gbbopen-tools
Arguments and values
list | A proper list | |
element | An object |
Returns
The sole element of list or nil
.
Errors
List contains more than one element.
Description
If list is a cons, nil
,
nil
. If list is a cons
and the cdr of that cons is not nil
, a continuable error is
signaled. If you continue from the error, the first element is returned.
This function is preferable to
Examples
> (sole-element '(a)) a > (sole-element nil) nil > (sole-element '(a b)) Error: The list (a b) contains more than 1 element. If continued - Ignore the remaining elements. >>
Note
This function is compiled in-line for top performance.
The GBBopen Project
![]() | ![]() | ![]() | sole-element | ![]() |