Sorted List Utils (#311)

append (list,list,..) => result of concatenating the given lists
reverse (list) => reversed list
remove_duplicates (list) => list with all duplicates removed
compress (list) => list with consecutive duplicates removed
setremove_all (list,elt) => list with all occurrences of elt removed
find_insert (sortedlist,e) => index of first element > e in sortedlist
sort (list[,keys]) => sorted list
count (elt,list) => count of elt found in list.
flatten (list) => flatten all recursive lists into one list

make (n[,e]) => list of n copies of e
range (m,n) => {m,m+1,...,n}

arrayset (list,val,i[,j,k...]) => array modified so that list[i][j][k]==val

-- Mapping functions (take a list and do something to each element):

map_prop ({o...},prop) => list of o.(prop) for all o
map_verb ({o...},verb[,args) => list of o:(verB)(@args) for all o
map_arg ([n,]obj,verb,{a...},args) => list of obj:(verB)(a,@args) for all a

-- Association list functions --

An association list (alist) is a list of pairs (2-element lists), though the following functions have been generalized for lists of n-tuples (n-element lists). In each case i defaults to 1.

assoc (targ,alist[,i]) => 1st tuple in alist whose i-th element is targ
iassoc (targ,alist[,i]) => index of same.
assoc_prefix (targ,alist[,i]) => ... whose i-th element has targ as a prefix
iassoc_prefix(targ,alist[,i]) => index of same.
slice (alist[,i]) => list of i-th elements
sort_alist (alist[,i]) => alist sorted on i-th elements.

See also: ?$set_utils

You are not logged in.

[home | help | who | search | setup | code]