Print

Print


Hi,

A couple of replies in-line.


On 14/03/2011, at 9:28 AM, Bruno Le Floch wrote:

> Will's version (and I guess yours if you use
> `\quark_if_recursion_tail_stop:n`) breaks for items like
> {{{{{{a}}}}}}, or some cases with conditionals. So let me also propose
> a fix for `\quark_if_recursion_tail_stop:n` and friends (see attached
> for examples where the current version is broken, and for the fix).

Whose version? :)
I think Morten was the last person to significantly re-write l3seq -- nothing to do with me!

I'm not so fussed about the edge cases with mismatched conditionals, but the {{{{{{a}}}}}} problem is more serious. I'll look into it. I haven't seen that catcode trick for comparing emptiness -- is it any better than \tl_if_empty ?


On 14/03/2011, at 9:48 AM, Bruno Le Floch wrote:

> It is very easy to convert from the braced to the delimited version using
> 
>    \cs_set:Npn \seq_elt:n #1 {\seq_elt:w #1 \seq_elt_end:}
> 
> See code below for the full code corresponding to what you wrote.

That's true; I guess the difference is negligible.


> \use_none:nnn \seq_elt_end: \q_break {} % break in the "new" way.
>  \cs_set_eq:NN \seq_elt:w \ERROR
>  \cs_set_eq:NN \seq_elt:n \ERROR

Surely the break has to come at the end so that any \seq_map_break:n puts its argument after all the cleanup?
(I only just fixed this up in the repository; \seq_map_break:n has been broken in this regard, I think, ever since I first added it. (I.e., not Morten's fault!))

This reminds me that after I implemented the break using a gobbling-up-until marker, I realised it would have been more in the spirit of the seq code to just define

    \cs_set:Npn \seq_elt:w #1 \seq_elt_end: {}

and if you need to execute some code at the end to end the mapping with

    \seq_map_end:

that was normally \prg_do_nothing: but could be redefined as necessary. Never got around to trying out the different versions; the above would be nice and simple.

-- Will