In the code below, what should the definition of \sumcounters
be to make it sum the current values of the counters thm
and lemma
?
\documentclass{book}
\usepackage{amsthm}
\usepackage{xparse}
\newtheorem{thm}{Theorem}[chapter]
\newtheorem{lemma}{Lemma}[chapter]
\ExplSyntaxOn
\seq_new:N \g_my_counters
\seq_gput_right:Nn \g_my_counters { thm }
\seq_gput_right:Nn \g_my_counters { lemma }
% \NewDocumentCommand{\sumcounters}{}{< ? >}
\ExplSyntaxOff
\begin{document}
\chapter{Some chapter}
\sumcounters % should print 0
\begin{thm}
A theorem.
\end{thm}
\sumcounters % should print 1
\begin{lemma}
A lemma.
\end{lemma}
\sumcounters % should print 2
\end{document}