On 14/09/2008, at 4:49 PM, Joseph Wright wrote:

> It might be handy to have a check to see if a value is any quark, for
> "make safe" code. So far, I've ended up with:
>
> \def_new:Npn \if_quark:NT #1 {
>  \exp_after:NN \exp_after:NN \exp_after:NN \if_quark:w
>    \exp_after:NN \token_to_string:N #1 \q_stop
> }
>
> \def_new:Npn \if_quark:wT #1#2#3\q_stop {
> \int_compare:nNnT {\char_value_uccode:n{#2}} = {Q}
> }
>
> which seems to work but I'm worried may not be suitable more
> generally.
> Any ideas?

Hmmm. What about if quarks contained an additional parameter to make
this check more robust?

Let's say

\def_new:Npn \quark_new:N #1{\tlp_new:Nn #1{\q_quark#1}}

Oh.
But I guess you don't want to be doing any expansion in the \if_quark
function so you wouldn't be able to see if \q_quark was there or not.

Never mind, I suppose.

W
`