I'm trying to define a local function with parameters in expl3 where the replacement text of that function should be the content of a token list variable.
My current approach is
\tl_set:Nn \l_tmpa_tl { \textbf{##1} }
\exp_args:NNnV \cs_set:Npn \foo {##1} \l_tmpa_tl
\cs_show:N \foo
where the expected output is something like
\foo #1:->\textbf {#1}
but it results in
! Illegal parameter number in definition of \reserved@b.
How do you handle such dynamic function definitions in expl3?