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
Sender: Mailing list for the LaTeX3 project <[log in to unmask]>
Date: Mon, 14 Jan 2008 23:41:13 +0100
Reply-To: Mailing list for the LaTeX3 project <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
In-Reply-To: <[log in to unmask]>
Content-Type: text/plain; charset=us-ascii
From: Frank Mittelbach <[log in to unmask]>
Parts/Attachments: text/plain (86 lines)
Andreas Matthias writes:
 > > 
 > >> 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:


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

just got around reading that and somehow I don't think this syntax is right

just a minute ago I coded 

    {\seq_if_empty_p:N \g_xor_floats_active_seq }
     \seq_gpop:NN \g_xor_floats_active_seq 
     \xor_extract_this_float_values:N  \g_xor_curr_float_box_tlp

using this function for the first time and that gave some surprising results
(for me) ... then looking at the implementation of \prg_whiledo:nF and this
discussion not so surprising. 

But I don't think that:

 > The idea behind these generic constructs is to have input as
 >    \prg_whiledo:nT {% or F
 >      <various stuff>
 >      \some_test_function:..T % or :..F
 >    }
 >    { <true code> }

this is memorable syntax. it is kind of the mixture between \loop \repeat
syntax idea and the argument based TF ideas. 

And it doesn't go too well with something like



I'm not saying that the construct as such isn't useful (though it is playing
somewhat badly on the argument stack as this isn't tail recursion, is it?)
but I don't think the syntax fits well though I don't have a good alternative
suggestion right now ...


ps ... seems that there has been some documentation change recently my
hard copy that I use here the exact requirements about using T or F functions
for the test aren't written down  ... reading that helps :-)