I'm trying to write a macro that converts a sequence to a table.
The following code works fine:
\documentclass{article}
\usepackage{expl3}
\begin{document}
\noindent
\ExplSyntaxOn
\seq_new:N \l_my_a_seq
\seq_set_split:Nnn \l_my_a_seq { ; } { (a, b); (b, c); (c, a) }
\tl_new:N \l_my_b_tl
\cs_new:Npn \printsequence:N #1 {
\seq_pop_left:NNTF #1 \l_my_b_tl {
\tl_use:N \l_my_b_tl \\
\printsequence:N #1
} {
}
}
\printsequence:N \l_my_a_seq
\ExplSyntaxOff
\end{document}
and outputs this:

But when I try to place it inside a table, it stops working. The following code results in "TeX capacity exceeded":
\documentclass{article}
\usepackage{expl3}
\usepackage{tabularx}
\begin{document}
\noindent
\ExplSyntaxOn
\seq_new:N \l_my_a_seq
\seq_set_split:Nnn \l_my_a_seq { ; } { (a, b); (b, c); (c, a) }
\tl_new:N \l_my_b_tl
\cs_new:Npn \printsequence:N #1 {
\seq_pop_left:NNTF #1 \l_my_b_tl {
\tl_use:N \l_my_b_tl \\
\printsequence:N #1
} {
}
}
\begin{tabular}{|c|}
\printsequence:N \l_my_a_seq
\end{tabular}
\ExplSyntaxOff
\end{document}
What is the problem here? I haven't used macros before, so I don't know a lot about them.