I am trying to make macro with variadic arguments, iterating over them. The final result is supposed to be:
\foreach[x]((var = \x )){foo}{bar}{baz}\null
evals to
var = foo var = bar var = baz
My naive guess is this one:
\def\Macro#1{\if \null#1 . \else ,\noexpand\Macro \fi}
\Macro foogg\null
I expected it to eval to ,,,,,., but it evals to ,oogg.
Am I understanding \noexpand behavior wrong?
\if\null#1will always evaluate to false, because\ifexpands tokens and the expansion of\nullis\hbox{}, so\ifis comparing\hboxto{. – egreg Mar 02 '13 at 16:54pgfforandetoolbox) would be able to assist in your task. See Cunning (La)TeX tricks, for example. – Werner Mar 02 '13 at 17:26