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:
Uwe Lück <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Sun, 26 Apr 2009 08:27:38 +0200
Content-Type:
multipart/mixed
Parts/Attachments:
text/plain (1779 bytes) , in.tex (1292 bytes)
At 20:37 25.04.09, Heiko Oberdiek wrote:
>On Sat, Apr 25, 2009 at 06:24:08PM +0200, Uwe Lück wrote:
> > >On 24/04/2009, at 6:51 PM, Heiko Oberdiek wrote:
> > >>%%% begin of fixed definition %%%
> > >>\def\in@#1#2{%
> > >> \def\in@@##1#1##2\in@@{%
> > >>   \def\in@@{##2}%
> > >>   \ifx\in@@\@empty
> > >>     \in@false
> > >>   \else
> > >>     \in@true
> > >>   \fi
> > >> }%
> > >> \in@@#2\@nil#1\in@@
> > >>}
> > >>%%% end of fixed definition %%%
> >
> > (This uses \@nil.) Putting the second split into a macro to test it 
> against
> > \@empty is safe, but one might dislike it as "slow".
>
>I prefer "safe".

The difference in safety is that other proposals can be fooled by \in@ or 
\in@@ in \in@ arguments. The "safe" proposal still can be fooled by \@nil 
or so in \in@ arguments.

> > Other proposals need
>
>I haven't seen any so far.

1. LaTeX-so-far, 2.changing it by just inserting a separator in the last 
line according to Morten:

\def\in@#1#2{%
\def\in@@##1#1##2##3\in@@{%
   \ifx\in@##2\in@false\else\in@true\fi}%
  \in@@#2\@nil#1\in@\in@@}

(where I proposed to use \@in@ in place of \@nil), and 3. mine (expandable 
test without \in@). (Attached is a file with testing tools for the four 
versions.)

In favour of Morten's: it is the least change (compatibility).

>An expandable test could be used, e.g.:
>   \ifx\\##2\\% or something else as \\
>instead of
>   \def\in@@{##2}%
>   \ifx\in@@\@empty
>But the disadvantage is that an unmatched \if..., \else or \fi inside ##2
>breaks the \if constructs of \in@@, thus it isn't safe. And because
>exandibility isn't neede here (the first definition destroys this
>property anyway), I have used the more safe test for emptiness in
>my proposal.

Right, on the other hand \in@{a}{a#} and \in@{b}{a#} work with the 
expandable tests only.

Cheers,

     Uwe.



\makeatletter \ProvidesFile{in.tex}[2009/04/25                       testing \string\in@\space versions (Uwe Lueck)] \nofiles %% \in@ VERSIONS: % LaTeX so far: \expandafter \let \csname in@LaTeX-so-far\endcsname \in@ % \def\in@#1#2{% % \def\in@@##1#1##2##3\in@@{% % \ifx\in@##2\in@false\else\in@true\fi}% % \in@@#2#1\in@\in@@} % Morton: \def\in@morton#1#2{%  \def\in@@##1#1##2##3\in@@{%   \ifx\in@##2\in@false\else\in@true\fi}%  \in@@#2\@nil#1\in@\in@@} % Heiko: \def\in@heiko#1#2{%  \def\in@@##1#1##2\in@@{%   \def\in@@{##2}%    \ifx\in@@\@empty \in@false    \else \in@true    \fi}  \in@@#2\@nil#1\in@@} % Uwe: \newcommand*{\in@uwe}[2]{%  \def\in@@##1#1##2\in@@{%   \ifx\in@@##2\in@@\in@false\else\in@true\fi}%  \in@@#2\in@#1\in@@} %% MACROS FOR TESTING: \newcommand*{\UseInVersion}[1]{%   \expandafter \let \expandafter \in@tested \csname in@#1\endcsname   \typeout{Using \string\in@-version `#1'%   \space which is:^^J\expandafter \meaning \csname in@#1\endcsname   ^^J...:% }} \newcommand*{\InTest}[2]{%   \in@tested{#1}{#2}\typeout{`#1' \ifin@\else not \fi in `#2'!}} %% ACTUAL TESTING: \UseInVersion{LaTeX-so-far} % \UseInVersion{morton} % \UseInVersion{heiko} % \UseInVersion{uwe} \InTest{bonbon}{bon} \InTest{bon}{bonbon} \InTest{bona}{bon} \InTest{bon}{bona} \InTest{msam}{msa} \InTest{ionization}{ionizat} \stop

ATOM RSS1 RSS2