\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#358: Suppress Empty List Element Generation from the Split Command}
\date{October 04, 2009}
\author{George Petasis}
\urlstyle{sf}
\setlength{\parskip}{1ex}
\setlength{\parindent}{0pt}
\def\tipversion$#1${\texttt{\$#1\$}}
\def\tiplangle#1{\ensuremath{<}}
\def\tiprangle#1{\ensuremath{>}}
\def\tipbar#1{\ensuremath{|}}
\def\tipmail#1#2{\(\langle\){\small\expandafter\url{#1@#2}}\(\rangle\)}
\ifx\pdfoutput\undefined
\newcommand{\tipimage}[2]{\typeout{Make sure you download #1.eps}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.eps}}{\includegraphics[width=0.8\textwidth]{#1.eps}}}
\newcommand{\tipxref}[1]{}
\newcommand{\tipxrefend}{}
\else
\newcommand{\tipimage}[2]{\typeout{Make sure you create #1.pdf}\ifthenelse{\lengthtest{0.8\textwidth>#2}\and\lengthtest{0pt<#2}}{\includegraphics{#1.pdf}}{\includegraphics[width=0.8\textwidth]{#1.pdf}}}
\pdfcatalog{/PageMode /UseOutlines}
\newcommand{\tipxref}[1]{\pdfannotlink attr {/C [0.5 0.5 1.0] /Border [0 0 1]} goto name {#1}}
\newcommand{\tipxrefend}{\pdfendlink}
\fi
\newenvironment{tipabstract}{\begin{abstract}}{\end{abstract}}
\begin{document}\maketitle
\begin{center}\begin{tabularx}{\linewidth}{|r@{: }X|}\hline
\textbf{TIP \#358}&\textbf{Suppress Empty List Element Generation from the Split Command}\\\hline
Author&

George Petasis \tipmail{petasis}{iit.demokritos.gr}
\\
Created&Sunday, \(\text{4}^{\text{th}}\) October 2009\\
Type&Project\\
Tcl Version&\(8.7\)\\
State&Draft\\
Vote&Pending\\
Version&\tipversion$Revision: 1.2 $\\
Keywords&Tcl, list extraction, parsing\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

The \textbf{split} command will create empty list elements when adjacent split characters are found in the input. In some cases these empty list elements are not desired, so this TIP proposes a new switch to disable their generation.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

The idea for this TIP came from a discussion in comp.lang.tcl: [\url{http://groups.google.gr/group/comp.lang.tcl/browse_thread/thread/8d46b0f10e7a5750/d7844cc739aa4310}] and the (non obvious) suggestions on how tokens can be extracted from a string can be performed efficiently.

It should be noted that this will allow the \textbf{split} command to be used in a fashion that is very similar to how splitting works in many other languages (e.g., Perl, awk, Unix shells).

\section{Specification}

This TIP proposes a new optional switch (\textbf{-noemptyelements}) to the \textbf{split} command:

\begin{quote}
\textbf{split -noemptyelements} \textit{string} ?\textit{splitChars}?
\end{quote}

If this option is present, then \textbf{split} will not produce an empty list element when the \textit{string} contains adjacent characters that are present in \textit{splitChars}.

\section{Reference Implementation}

Currently there is no patch, but it should be quite easy to implement this.

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\end{document}
