Friends, I used to suffer a lot when had to iterate through elements of a list, but thanks to egreg's suggestion, I've been successfully using the etoolbox package for that task, e.g.:
\DeclareListParser*{\dothedance}{;}
\dothedance{\fbox}{item1; item2; item3}
Now, I'm trying to get all the pairs of a cartesian product of two lists (pardon the following Haskell code):
Prelude> [ (x,y) | x <- ['A','B','C'], y <- ['a','b','c','d'] ]
[('A','a'),('A','b'),('A','c'),('A','d'),('B','a'),('B','b'),('B','c'),('B','d'),('C','a'),('C','b'),('C','c'),('C','d')]
Then, for each pair, I'd like to break it into two parameters (x and y) and pass them to a command.
For example, consider two lists [Hello, Howdy] and [Ann, Mary, Kate] and the following dummy command:
\newcommand\saysomething[2]{#1~#2}
I'd expect each pair to be the parameters of that command. So the output would be:
Hello Ann
Hello Mary
Hello Kate
Howdy Ann
Howdy Mary
Howdy Kate
I'm pretty sure etoolbox could help me on that, but all my attempts of iterating through two lists were unsuccessful. I'm probably missing something obvious, but I need enlightment. Any ideas?