LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
Date: Tue, 1 Jan 2008 18:28:15 +0100
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
In-Reply-To: <[log in to unmask]> ("Morten Høgholm"'s message of "Tue\, 1 Jan 2008 17\:01\:02 +0100")
Content-Type: text/plain; charset=iso-8859-15
From: Andreas Matthias <[log in to unmask]>
Parts/Attachments: text/plain (67 lines)
Morten Høgholm wrote:

> On Mon, 31 Dec 2007 16:44:35 +0100, Andreas Matthias wrote:
> 
> Hi Andreas,
> 
>> I struggled a while to understand how to use \prg_whiledo:nT.
>> I think I figured it out, but it seems to be rather clumsy:
>> 
>> 
>> \RequirePackage{l3prg}
>> \ExplSyntaxOn
>> 
>> \tlp_new:N \a_tlp
>> \int_new:N \a_int
>> \int_zero:N \a_int
>> 
>> \prg_whiledo:nT {
>>   \tlp_set:Nx \a_tlp {
>>     \predicate_p:n {
>>       \int_compare_p:nNn \a_int < 4 &&
>>       \c_true % some complex tests here
>>     }
>>   }
>>   \exp_after:NN \tlp_if_eq:NNT \a_tlp
> 
> This last line should just be
>   \bool_if:NT \a_tlp
> and I can see we left out \bool_set:Nn functions which evaluate
> such  predicate expressions. It would make sense for such a
> function to work  that way, wouldn't it?

Yes, I missed it, too. But maybe one doesn't need it? At least, if
one uses \prg_whiledo:nT in a straight-forward way as in:

> The entire test could be simplified to
> 
> \prg_whiledo:nT {
>   \predicate:nT{
>     \int_compare_p:nNn \a_int < 4 &&
>     \c_true % some complex tests here
>   }
> }{
>   \io_put_term:x{Loop~ \int_use:N \a_int}
>   \int_incr:N \a_int
> }

Oh, yes. That's it: \predicate:nT. That's what I was looking for.
But yesterday I stubbornly sticked to \predicate_p:n again and again.

>> In xtheorem.sty it is used as:
>> 
>>     \prg_whiledo:nT{
>>       \int_compare:nNnT \etex_lastnodetype:D = \c_eleven
>>     }{\tex_unskip:D}
>> 
>> And actually, this was the way it expected it to work? But
>> it doesn't work, does it? I didn't run xtheorem.sty, though.

Well, again I was misleadingly thinking of \int_compare_p:nNn.
But \int_compare:nNnT succeeds, of course.

Thanks!

Ciao
Andreas

ATOM RSS1 RSS2