Re: how to compare two macros in TeX?

also sprach Rupert <rupert.debian@hotpop.com> [2002.11.19.1932 +0100]:
> This compares the complete expansions of whatever you throw at it:

nice. i didn't even think that far...

> \def\same#1#2{00\fi%
>   \edef\tmpone{#1}%
>   \edef\tmptwo{#2}%
>   \ifx\tmpone\tmptwo}
>
> \def\variable{somevalue}
>
> \if\same{\variable}{somevalue}
> same\else diff\fi

given that \ifx is part of the defintion, you don't need that \if,
right? then again i don't understand the 00\fi notation...

anyway, i think i'll just do this:

\def\same#1#2#3#4{
\edef\tmpone{#1}%
\edef\tmptwo{#2}%
\ifx\tmpone\tmptwo}#3\else#4\fi}

what's \edef compared to \def?
and why do TeX people put % at the end of the line so frequently?

--
. '
`