next up previous
Next: Interprocess Communication (iproc.ccl) Up: Standard Libraries Previous: External vs. Lambda

Common List Operations (list.ccl)

The list library contains a number of functions useful for manipulating lists and lists pretending to be arrays or vectors. The functions map, length, table and range are the workhorses of ccli.


rev L
Returns a list with the same elements as L, but in reverse order.


map f L
Returns a list obtained from L by applying f to each element of L.


length L
The length of the list L.


zip A B
Returns a list of pairs {{A[0],B[0]}, {A[1],B[1 }, ... }.


makelist n default
Returns the list that is n elements long all of whose elements are equal to default.


sumlist L
The sum of all the elements in L where L should be a list of numbers.


table f n m
Returns the list {f n, f (n+1), ..., f m}.


range n
Returns the list {0,1,...,n-1}.


member x L
Returns true if x appears in L and false otherwise.


remove x L
Returns a list identical to L, except with all occurences of elements equal to x removed.


cross A B
Returns the cross product of A and B taken as multisets.


tocol v
Good for changing a row vector into a column vector. It is equivalent to map ($\backslash$x.{x}) v.



next up previous
Next: Interprocess Communication (iproc.ccl) Up: Standard Libraries Previous: External vs. Lambda
Eric Klavins 2003-12-03