# Functions for nice handling of lists.
#
-function list_append() {
+list_append() {
local list=${1}
assert isset list
shift
done
}
-function list_append_one() {
+list_append_one() {
assert [ $# -eq 2 ]
local list="${1}"
fi
}
-function list_remove() {
+list_remove() {
local list=${1}
shift
eval "${list}=\"${_list}\""
}
-function list_sort() {
+list_sort() {
local i
for i in $@; do
print "${i}"
print
}
-function list_unique() {
+list_unique() {
local items item
for item in $@; do
# Check if the item has already been processed.
done
}
-function list_match() {
+list_match() {
local match=${1}
shift
return ${EXIT_ERROR}
}
-function list_length() {
+list_length() {
local length=0
local i
}
# Count how often $1 occurs in the list.
-function list_count() {
+list_count() {
local what=${1}
shift
print "${counter}"
}
-function list_join() {
+list_join() {
local list=${1}
local delim=${2}
print "${ret:${#delim}}"
}
-function list_reverse() {
+list_reverse() {
local reversed arg
for arg in $@; do
reversed="${arg} ${reversed}"
return ${EXIT_OK}
}
-function list_head() {
+list_head() {
local arg
for arg in $@; do
print "${arg}"