I'm reading the documentation for xparse and I'm rather interested in \SplitList. However there are some things about the description that I don't understand:
This processor splits the argument given at each occurrence of the ⟨token(s)⟩ where the number of items is not fixed. Each item is then wrapped in braces within #1. The result is that the processed argument can be further processed using a mapping function.
\NewDocumentCommand \foo
{ > { \SplitList { ; } } m }
{ \MappingFunction #1 }If only a single character ⟨token⟩ is used for the split, any category code 13 (active) character matching the ⟨token⟩ will be replaced before the split takes place. Spaces are trimmed at each end of each item parsed.
So there are two key things I don't understand and an underlying confusion I will get to later:
- I don't understand what it means for each item to be "wrapped in braces". As a brief investigation I wrote the following:
Which shows that whatever this is it doesn't seem to appear in the final document. It must be some sort of data convenience, but I have no idea what it is.\documentclass{article} \usepackage{xparse} \NewDocumentCommand\test{>{\SplitList{,}}o}{#1} \begin{document} \test[1,2,3] \end{document} - I can't figure out what
\MappingFunctionis. It could either be a real macro or just an example placeholder standing in for some certain kind of macro. I can find a few seemingly independent appearances of\MappingFunctionbut no documentation and those scant examples are incomprehensible to me.
Overall I'm just having issues with the types here. What type of object is #1 what type of object is \MappingFunction? I have been told that because of the history of tex there isn't really a grounded or principled type system for latex, but rather an endless hodgepodge of quick fixes and patches, which might make this question a little non-sensical. However I feel like I can't really know what to do with this object or how I can interact with it, without having an idea of what type it is and how that fits into the broader system.
So what sort of thing is #1 in this example? How do I interact with it?

{aaa}{bbbb}{\foo \bar}with braced items, and you can write a function to handle that – David Carlisle Jul 01 '22 at 17:04