\documentclass[]{article}
\usepackage{amsmath,graphicx,supertabular,hyperref,tabularx,ifthen}
\title{TIP \#334: Make 'lrepeat' Accept Zero as a Count}
\date{October 13, 2008}
\author{Michael Thomas Greer}
\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 \#334}&\textbf{Make 'lrepeat' Accept Zero as a Count}\\\hline
Author&

Michael Thomas Greer \tipmail{michael.thomas.greer}{verizon.net}
\\
Created&Monday, \(\text{13}^{\text{th}}\) October 2008\\
Type&Project\\
Tcl Version&\(8.6\)\\
State&Withdrawn\\
Vote&Pending\\
Version&\tipversion$Revision: 1.2 $\\
Keywords&empty list\\
Post History&\\
\hline\end{tabularx}\end{center}
\thispagestyle{empty}\pagestyle{empty}
\begin{tipabstract}

Following on from \cite{tip323}, the \textbf{lrepeat} command should also act gracefully when a repeat count of zero is used, as an empty list is still a valid list.
\end{tipabstract}
\tableofcontents\setcounter{page}{0}\clearpage\pagestyle{plain}

\section{Rationale}

A list of zero items is a valid, empty list. In my own experience (I cannot speak for others'), generating a list of \textit{N} identical elements is more often an algorithmic expression than a literal shorthand, and often enough an empty list is the correct result. All other core list commands properly handle empty lists; but \textbf{lrepeat} complains when given a count of zero repetitions, requiring additional code to handle this (doubly) exceptional condition.

\section{Proposal}

The \textbf{lrepeat} command should be changed so that when it's first, \textit{count}, argument is zero, it returns an empty list.

\section{Copyright}

This document has been placed in the public domain.

\section{Colophon}

\textit{TIP AutoGenerator --- written by Donal K. Fellows}
\begin{thebibliography}{TIP \#1}
\addcontentsline{toc}{section}{References}
\bibitem[TIP \#323]{tip323}
Colin McCormack,
Don Porter,
Kevin B. Kenny,
\emph{Do Nothing Gracefully},
on-line at \url{http://purl.org/tcl/tip/323.html}
\end{thebibliography}
\end{document}
