tcl-quill 0.3.0: Quill Project Automation System for Tcl/Tk

listutils(n): List Utilities -- quill(n)

SYNOPSIS
DESCRIPTION
COMMANDS
AUTHOR
SEE ALSO

SYNOPSIS

package require quill 0.3.0
namespace import ::quill::*
got list
interleave alist blist
ladd listvar items...
ldelete listvar items...
lmaxlen list
lshift listvar

DESCRIPTION

listutils(n) contains a number of list-manipulation commands.

COMMANDS

listutils(n) defines the following commands:

got list
Returns 1 if the list contains any elements, and 0 if the list is empty. This allows the programmer to write
if {[got $someListThatMightBeEmpty]} {
	...
}
instead of

if {[llength $someListThatMightBeEmpty] > 0} {
	...
}
Which seems somewhat trivial, but it reads better, and I'm less likely to mistype it than the "llength" version, which I seem to mistype about half the time.

interleave alist blist
Given two lists, returns the result of interleaving the elements of the two lists into a single list. If one list is shorter than the other, it is implicitly padded with empty strings.

If the elements of alist are unique, and blist contains no more items than alist, then the result is a valid dictionary.

ladd listvar items...
Appends the items to the named list variable only if they are not already present in the list. Returns the new list.

ldelete listvar items...
Removes the items from the list in the named list variable, and updates the variable. Returns the new list.

lmaxlen list
Returns the string length of the longest element in list.

lshift listvar
Pops the top element off of the stack contained in listvar, i.e., removes the first element from the list contained in listvar, and returns it.

AUTHOR

Will Duquette

SEE ALSO

quill(n).
Generated from listutils.manpage on Sat Nov 08 09:29:58 PST 2014