LATEX-L Archives

Mailing list for the LaTeX3 project


Options: Use Classic View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
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
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
From: Will Robertson <[log in to unmask]>
In-Reply-To: <[log in to unmask]>
Content-Transfer-Encoding: 7bit
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
Parts/Attachments: text/plain (45 lines)

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.


\if_contains_quarks_p:n{hello\abc}     ->  'false'
\if_contains_quarks_p:n{hello\q_stop}  ->  'true'


No matter how this function is implemented, it's always going to be  
slow. One approach might be (in LaTeX2e pseudocode):


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  

  - 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.)