Copyright © 2016 Ashok P. Nadkarni. All rights reserved.

1. Introduction

The tarray extension implements typed arrays and associated commands column and table. This page only provides reference documentation for commands. See the main contents for an introduction, programming guide and other reference documentation.

1.1. Installation and loading

Binary packages for some platforms are available from the Sourceforge download area. See the build instructions for other platforms.

To install the extension, extract the files from the distribution to any directory that is included in your Tcl installation’s auto_path variable.

Once installed, the extension can be loaded with the standard Tcl package require command.

% package require tarray
→ 0.8

2. Command reference

All commands are located in the tarray namespace.

2.1. Commands

column SUBCOMMAND …​

Operates on columns. See Column commands.

loop INDEXVAR VAR VALUES SCRIPT

In the first form, SCRIPT is executed for each element in VALUES with VAR taking on the value of each element or row in VALUES in turn. VALUES may be a column, table or a Tcl list.

The second form is similar but in addition INDEXVAR is assigned the index of the element.

prettify VALUES ?options?

Returns VALUES as a more readable string format. VALUES is expected to be a column or a table. If not, it is returned unchanged.

The command takes the following options

Table 1. Prettify options
Option Description

-full BOOLEAN

If true, the full table or column is formatted and returned. Otherwise, only the leading and trailing lines specified by the -head and -tail options are returned. For VALUES that is not a column or table, the entire string is returned irrespective of this option.

-head NELEMS

Specifies the number of leading elements that are included in the returned string. Ignored if VALUES is not a column or table.

-tail NELEMS

Specifies the number of trailing elements that are included in the returned string. Ignored if VALUES is not a column or table.

print VALUES ?CHANNEL? ?options?

Prints VALUES to the specified channel in a readable string format. CHANNEL defaults to stdout if unspecified. VALUES is expected to be a column or a table. If not, it is output as by the Tcl puts command. See Prettify options for a list of valid options.

table SUBCOMMAND …​

Operates on tables. See Table commands.