Mime-Version:
1.0 (Apple Message framework v928.1)
Content-Type:
text/plain; charset=US-ASCII; format=flowed; delsp=yes
Date:
Tue, 16 Sep 2008 08:25:31 +0930
Content-Transfer-Encoding:
7bit
|
Hi,
I've been thinking more about this.
Just so we're clear, what you're looking for is a function that can be
given a token list and return true or false depending if, without
expansion, the list contains a quark.
So:
\def\abc{\q_stop}
\if_contains_quarks_p:n{hello\abc} -> 'false'
\if_contains_quarks_p:n{hello\q_stop} -> 'true'
Right?
No matter how this function is implemented, it's always going to be
slow. One approach might be (in LaTeX2e pseudocode):
\edef\quarktest{\detokenize{\q_}}
\@ifin{\quarktest}{\detokenize{#1}}
\in@
But it's not necessarily robust. Maybe some punk will come along and
define a whole bunch of \q_ macros that aren't quarks. Or define
quarks that don't start with \q_. Or maybe you want to distinguish the
case when a quark has been misspelled.
Anyway, an alternative might be to globally record all quarks are
they're defined:
\def_new:Npn \quark_new:N #1{
\seq_push:Nn \g_all_quarks_seq {#1}
\tlp_new:Nn #1{#1}
}
Then \g_all_quarks_seq can be queried to answer the question "is this
token/control sequence actually a quark?". Not fast, but it's more
bullet-proof.
- What do you think?
- How necessary is it to be able to answer this question in general?
(I.e., when you're not looking for a *specific* quark.)
Will
|
|
|