File 'base/lists.tcl' (part of 'Pool_Base')

Description (short)
list operations
Written by
Andreas Kupries
Description
Collection of useful list operations
Depends on
Tcl
Keywords
list operations


::pool::list::apply (cmd list)

Applies cmd to all entries of list and concatenates the individual results into a single list. The cmd must accept exactly one argument.
Argument: cmd The command executed for each entry.
Argument: list The list to look at.
Returns: A list containing all results of the application of cmd to the list.

::pool::list::assign (varList list)

by Brent Welch
Assign a set of variables from a list of values. If there are more values than variables, they are ignored. If there are fewer values than variables, the variables get the empty string.
Argument: varList List of variables to assign the values to.
Argument: list The list to assign to the variables.

::pool::list::delete (listVar value)

by Brent Welch
Delete an item from the list stored in listVar, by value.
Argument: listVar The name of the variable containing the list to manipulate.
Argument: value The value searched (and deleted from the list).
Returns: 1 if the item was present, else 0.

::pool::list::exchange (listVar position newItem)

Removes the item at position from the list stored in variable listVar and inserts newItem in its place.
Argument: listVar Name of variable containing the list to be manipulated.
Argument: position Index of the element to remove.
Argument: newItem The element to insert into the place of the removed one.
Returns: The changed list.

::pool::list::filter (list pattern)

All words contained in the list pattern are removed from list. In set-notation: result = list - pattern
Argument: list The list to filter
Argument: pattern The list of words to remove from list
Returns: Setdifference of list and pattern

::pool::list::head (list)

Argument: list The list to look at.
Returns: The first element of list.

::pool::list::last (list)

Argument: list The list to look at.
Returns: The last element of list.

::pool::list::lengthOfLongestEntry (list)

Determines the length of the longest entry contained in the list.
Argument: list The list to look at.
Returns: The length of the longest entry.

::pool::list::match (list pattern)

All words not contained in list pattern are removed from list. In set-notation: result = intersect (list, pattern). This is not completely true, duplicate entries in 'list' remain in the result, given that they appear at all.
Argument: list The list to filter
Argument: pattern The list of words to accept in list
Returns: Nearly the intersection of list and pattern

::pool::list::pop (listVar)

Removes the last element of the list contained in variable listVar.
Argument: listVar name of variable containing the list to manipulate.
Returns: The last element of the list, or {} in case of an empty list.

::pool::list::prepend (listVar newElement)

The list stored in the variable listVar is shifted up by one. newElement is inserted afterward into the now open head position.
Notes: The same as ::pool::list::unshift, just under a different name.
Argument: listVar The name of the variable containing the list to manipulate.
Argument: newElement Data to insert before the head of the list.
Returns: newElement

::pool::list::prev (list)

Argument: list The list to look at.
Returns: Everything before the last element of list.

::pool::list::projection (list column)

Treats list as list of lists and extracts the column'th element of each list item. If list is seen as matrix, then the procedure returns the data of the specified column.
Argument: list The list to search through.
Argument: column Index of the column to extract from list.
Returns: A list containing the extracted items.

::pool::list::push (listvar args)

The same as 'lappend', provided for symmetry only.
Argument: listvar The name of the variable containing the list to manipulate.
Argument: args List of objects to append to the list.
Returns: As of 'lappend'.

::pool::list::remove (listVar position)

Removes the item at position from the list stored in variable listVar.
Argument: listVar The name of variable containing the list to manipulate.
Argument: position index of the element to remove.
Returns: The changed list.

::pool::list::reverse (list)

Argument: list the list to manipulate.
Returns: Returns the reversed list.

::pool::list::select (list indices)

General permutation / selection of list elements. Takes the elements of list whose indices were given to the command and returns a new list containing them, in the specified order.
Argument: list The list to select from, the list to permute.
Argument: indices A list containing the indices of the elements to select.
Returns: is a list containing the selected elementes, in the order specified by indices.

::pool::list::shift (listVar)

The list stored in the variable listVar is shifted down by one.
Argument: listVar name of the variable containing the list to manipulate.
Returns: The first element of the list stored in listVar, or {} for an empty list. The latter is not a sure signal, as the list may contain empty elements.

::pool::list::tail (list)

Argument: list The list to look at.
Returns: Everything behind the first element of list.

::pool::list::uniq (list)

Removes duplicate entries from list.
Argument: list The list to manipulate.
Returns: The modified list.

::pool::list::unshift (listVar newElement)

The list stored in the variable listVar is shifted up by one. newElement is inserted afterward into the now open head position.
Notes: The same as ::pool::list::prepend, just under a different name.
Argument: listVar The name of the variable containing the list to manipulate.
Argument: newElement Data to insert before the head of the list.
Returns: newElement


Generated by AutoDoc 2.4 at 09/14/2000, invoked by Andreas Kupries