TIP #251 Version 1.2: Enhance the 'list' Command

This is not necessarily the current version of this TIP.


TIP:251
Title:Enhance the 'list' Command
Version:$Revision: 1.2 $
Author:Brian Schmidt <contact at schmidtsrus dot net>
State:Draft
Type:Project
Tcl-Version:8.5
Vote:Pending
Created:Tuesday, 28 June 2005

Abstract

This TIP proposes enhancing the existing list command to serve as a top-level command container for all the related list commands that have proliferated over time, as well as future new list-based commands.

Rationale

There are numerous top-level commands for lists already. This command would centralize them, making it easier for new users to see all the related list commands. The enhanced list would be consistent with the new top-level commands chan TIP #208 and dict TIP #111, as well as the existing string and file commands.

Specification

A new command list will be added with the following syntax:

list append     ;equivalent to lappend
list index      ;equivalent to lindex
list insert     ;equivalent to linsert
list create     ;equivalent to list
list length     ;equivalent to llength
list range      ;equivalent to lrange
list replace    ;equivalent to lreplace
list search     ;equivalent to lsearch
list set        ;equivalent to lset
list sort       ;equivalent to lsort
list concat     ;equivalent to concat
list join       ;equivalent to join

Each represents the existing command that is commented. The arguments to each would remain what the current command takes.

Note that split is not included as it ideally should be part of the string top-level command as it operates on a string and returns a list (i.e. string split would be like the current split command, see TIP #252).

The old commands could then potentially be deprecated:

lappend
lindex
linsert
llength
lrange
lreplace
lsearch
lset
lsort
concat
join

Copyright

This document has been placed in the public domain.


Powered by TclThis is not necessarily the current version of this TIP.

TIP AutoGenerator - written by Donal K. Fellows