One lack of LaTeX and friends that I have NEVER understood is that there are no character-manipulation tools.

In many languages, there are a large number of such tools.

substr - get part of a string
scan - break string into pieces by several markers (usually can specify)
index - determine if string has substring

and there are 20-30 more too

Admittedly this goes toward making LaTeX more of a programming language, but it is a thought of something missing.

Paul A. Thompson

Division of Biostatistics
Washington University School of Medicine
St Louis, MO 63108
314-747-3793

25 Signal Hill Blvd
Belleville, IL   62223-1650
618-394-1246

----- Original Message ----
Sent: Saturday, January 24, 2009 10:06:00 AM
Subject: comma lists, semicolon lists, vbar lists

Hello,

There is currently a module in the expl3 bundle for dealing with lists of tokens separated by commas. While there is a small application of these things in areas such as XeTeX's font feature selection, this is generally designed to offer convenient ways for users to input lists of things.

My question for LaTeX3 is, "are commas enough?".

The current l3doc macros define the {function} environment that uses vertical bar separated lists of function names:
\begin{function}{ \seq_push:Nn | \seq_push:NC }

I've written a LaTeX2e package called mlist that deals with "math lists" that I define as two-d lists of items that eventually turn out to be functions or matrices or vectors or whatever:
\matr{ a , b ;
c , d }

Whether we're dealing with commas, semicolons, or vertical bars, the basic functions for manipulating the data would be largely identical.

There are two points of view here. One is that we should avoid making things more complex than they already are and highly suggest that if lists like this are going to be defined, then it's comma-lists or it's nothing.

The other point of view is that we should allow some flexibility in how users may end up needing to input list-like data, and providing a range of delimited list types will be more convenient for (a) multi-dimensional lists such as used by mlist, and (b) not having to escape the delimiting characters as much; say if the list is likely to contain commas then you can delimit it with vertical bars instead.

I lean towards the second philosophy. My tentative proposal is to rename the clist module to, er, something else, and for it to generalise the functions in clist such that functions for new "delimiter"-lists can be instantiated with a single command.

I.e., the hypothetical command
\def_delimiter_list:nn {clist} {,}
would generate the suite of functions that are currently defined in l3clist;
\def_delimiter_list:nn {slist} {;}
might then define equivalent commands for dealing with semi-colon delimited lists.

* * *

Alternatively, maybe I'm taking this way too far and all we need is a generalised mapping function that can loop through a token list using an arbitrary substring as a delimiter. That would probably cover the majority of the cases that \def_delimiter_list would be useful for.

* * *