3

Wondering if token lists can be used to manage property list collections, and create sequences out of them, or if seq are required in order to work with collections of property lists. That is, it seems like the functionality of seq is encapsulated within token lists, but I can't tell so far.

For example, both seq and tl have seq_put_left and tl_put_left, and other similar methods.

Not sure from reading the documentation if you can actually store property lists in token lists as items. It would be helpful to see pseudocode on how to build a seq or a prop list out of a token list from scratch to get a better handling of the implementation.

5

You mention three data types:

  1. token lists;
  2. sequences;
  3. property lists.

Note that “token list” is also used in the broader sense of anything that’s passed to TeX for later processing. So it’s better to talk about “token list variable” when referring to the restricted sense.

A variable of type tl (token list) holds a single object, which however can be processed in various ways (by splitting it or augmenting it at either end).

A variable of type seq (sequence) is a linearly ordered set of items (each one a token list in the broader sense) which can be augmented at either end, but each item makes a single unit and is indexed by an integer.

A variable of type prop (property list) is an unordered set of items indexed by keys.

What variable type to choose depends on the application. Variables of type tl are much more rigid than the other two types. For instance, if you do

\seq_put_right:Nn \l_tmpa_seq {abc}
\seq_put_right:Nn \l_tmpa_seq {def}

the two items abc and def will be distinctly stored; with

\tl_put_right:Nn \l_tmpa_tl {abc}
\tl_put_right:Nn \l_tmpa_tl {def}

you cannot retrieve abc or def as a unit from the variable any longer.

Transforming a seq into a tl is easy:

\tl_set:Nx \l_tmpa_tl { \seq_use:Nn \l_tmpa_seq { } }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.