# Using control sequence names to efficiently store a large amount of characters

A long string of characters is stored more efficiently as a csname than as a list of tokens. This has been used at some point in l3fp, storing 10000 decimals of 1/(2pi) as \159154943091895..., to be passed to \string when needed.

I can't find that definition in the l3fp files and I'm curious how it works. The problem seems to boil down to the question "How do you refer to a control sequence name without knowing the full name?" For example, if you assign a shorter name \expandafter\let\expandafter\short\csname very long name\endcsname, you can't refer to the original name with \short later because only the meaning is assigned to \short. On the other hand, a construction that involves \def or similar pretty much defeats the purpose because then you need to store the characters as tokens again.

What is the (plain TeX/e-TeX) pattern used here that makes this efficient string storing work?

• It used to be that way in l3fp, but now the same is achieved with \intarray which is even more efficient (it uses \fontdimen). Sep 4, 2018 at 22:20
• From the section of l3fp-trig.dtx where this is done (with a new method, as egreg said): "The memory footprint (1/2 byte per digit) is the same as an earlier method of storing the data as a control sequence name, but the major advantage is that we can unpack specific subsets of the digits without unpacking the 10112 decimals." Sep 4, 2018 at 22:29
• I don't see why you say you need to store the character tokens if using a macro \edef\zzz{\expandafter\noexpand\csname 1234567890\endcsname} is equivalent (if you set catcodes up) to \def\zzz{\1234567890} and stores the 10 digit number as a single csname, which you can get back the digits via \meaning\zzz Sep 5, 2018 at 0:20

\edef\zzz{\expandafter\noexpand\csname 1234567890\endcsname}

\def\zzz{\1234567890}

The number can be retrieved by \meaning\zzz or \expandafter\string\zzz and stripping the respective prefix.