LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

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

Print Reply
Subject:
From:
Joseph Wright <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Thu, 2 Feb 2012 10:44:09 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (47 lines)
On 02/02/2012 10:29, dongen wrote:
> Howsagoin,
> 
> 
> I've started exploring the LaTeX3 sources documentation but
> I couldn't find the equivalent of the following predicate
> functions for token lists:
> 
>  o  \tl_all_TF:NNTF <token list> <predicate> <true> <false>
>     results in <true> if all members of <token list> satisfy
>     <predicate>. The semantics should be that the evaluation
>     is start-to-finish of <token list> but that the evaluation
>     is aborted as soon as one of the tokens in <token list>
>     doesn't satisfy <predicate>.
>  o  \tl_some_TF:NNTF <token list> <predicate> <true> <false>
>     results in <true> if some member of <token list> satisfies
>     <predicate>. The semantics should be that the evaluation
>     is start-to-finish of <token list> but that the evaluation
>     is aborted as soon as one of the tokens in <token list>
>     satisfies <predicate>.
> 
> Similar versions may also be useful for other kinds of lists.
> 
> Are such macros defined? If not, do you think it's a good idea
> to introduce them?
> 
> Regards,
> 
> 
> Marc van Dongen

Hello Marc,

There is certainly nothing at present in l3kernel to do this. What I am
not sure of here is a use case: these seem somewhat unusual functions.

Although it is not yet in l3kernel, I wonder if this is a job for the
l3regex module that Bruno has written. Using a regex, it is possible to
specify complex token list requirements without needing lots of
dedicated functions (at the cost of performance). (The regex code is in
l3experimental.) For example, The following shoul (I hope) match a token
list made up entirely of letters with category code 'letter'

  \regex_match:nnTF { <tokens> } { ^\c[a-zA-Z]L+$ } ...
-- 
Joseph Wright

ATOM RSS1 RSS2