Sender: |
|
Date: |
Thu, 2 Feb 2012 13:35:58 -0500 |
Reply-To: |
|
Subject: |
|
MIME-Version: |
1.0 |
Message-ID: |
|
In-Reply-To: |
|
Content-Type: |
text/plain; charset=ISO-8859-1 |
From: |
|
Parts/Attachments: |
|
|
Hi Lars,
>> I've been wondering: should it be called "regex" or "regexp"?
>
> My preference is for "regexp", but I can see it might by now be a bit
> awkward to change it.
My original argument in favor of regex (besides the fact that
Wikipedia's regex(p|) page uses that and that it's shorter) is that it
matches nicely with (La|)TeX. Before I planned to include it in
LaTeX3, I thought of calling the package ReGeX. :-)
>> Like Joseph, I don't see how useful the functions you propose are. Do
>> you have a precise use case?
>
> Imprecisely, I suspect one might find such predicates useful when about to
> choose between two methods of doing something: one which is quick, but only
> works in the (common) simple case, and one which is general but slow.
> Whether that happens frequently enough for them to be put in the kernel is
> another matter.
The approach I described with \tl_map_inline:nn and \prg_map_break:
seems pretty much as fast as a hard-coded version. Alternatively, for
an expandable version, you could use
\cs_new:Npn \your_test:n #1
{ \str_if_eq:nnT { bingo! } {#1} { \use_ii:nnn } }
%....
\tl_map_function:NN \l_your_tl \your_test \use_ii:nn
{ True code }
{ False code }
Of course, the non-expandable version is cleaner. But I somewhat doubt
that people who really need the expandable version can't code that
easily. Dunno.
> sidetracked by other projects (in this case, actual research)
Research does that to people :-). I'm off to work on my PhD for a short bit.
Cheers,
Bruno
|
|
|