Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id p1L0kHvN022280 for ; Mon, 21 Feb 2011 01:46:18 +0100 Received: (qmail 2938 invoked by alias); 21 Feb 2011 00:46:12 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 21 Feb 2011 00:46:12 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx015) with SMTP; 21 Feb 2011 01:46:12 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p1L0hB2S018989 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 21 Feb 2011 01:43:11 +0100 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p1KN1Cgv022481; Mon, 21 Feb 2011 01:42:59 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1205242 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Mon, 21 Feb 2011 01:42:59 +0100 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id p1L0gx1N028988 for ; Mon, 21 Feb 2011 01:42:59 +0100 Received: from mail-iw0-f177.google.com (mail-iw0-f177.google.com [209.85.214.177]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p1L0gqZo018905 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=FAIL) for ; Mon, 21 Feb 2011 01:42:56 +0100 Received: by iwn38 with SMTP id 38so6628057iwn.22 for ; Sun, 20 Feb 2011 16:42:51 -0800 (PST) Received: by 10.42.218.3 with SMTP id ho3mr1121218icb.437.1298248971609; Sun, 20 Feb 2011 16:42:51 -0800 (PST) Received: from staff-250-255.wireless.adelaide.edu.au (staff-250-255.wireless.adelaide.edu.au [129.127.250.255]) by mx.google.com with ESMTPS id d21sm4600379ibg.21.2011.02.20.16.42.48 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 20 Feb 2011 16:42:50 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) References: X-Mailer: Apple Mail (2.1081) X-Spam-Whitelist: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id p1L0gx1N028989 Message-ID: Date: Mon, 21 Feb 2011 11:12:48 +1030 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Will Robertson Subject: Re: Fully expandable "x" argument (was "expandable \uppercase...") To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p4U4jfdfC5HDevlx1X2sAZgP9e9F2VTUYI/FLDAh5vXTVin+wznIYULO4W8f iu4UIHVeutAdNYNyhIIRpjhB4NMqCt7OvFNAZ3Em9oZmuR2zOKGeZpAGdnSMvI6CR2LHXlIcSoSO ckeoA==V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 6611 On 18/02/2011, at 2:49 PM, Bruno Le Floch wrote: > I ended up defining a new data structure: "conversion table" (ctab), > which behaves somewhat like a property list, plus a bunch of special > methods (for brace groups, etc.). For efficiency reasons, I went for > the "one macro per token" approach. This can be changed later. > > Since the code leads to an expandable version of the "x" argument > specifier, I took the liberty of defining a *new argument type*, "e" > (for expandable x), via \::e. See Sections 2.5.5 and 2.5.4 for > details. I managed to only have a quick look at this over the weekend. I like the look of the package, and well done for the good documentation. I am especially interested in this last part with the e-type argument, especially its relationship to LuaTeX's \expanded primitive (also available in pdfTeX >= 1.5, if it's turning up in TL this year?). Do you think that we'd be able to add 'e' as an argument type using your code above where necessary and replace it with \expanded if it's available? Or will there be edge cases to cause us headaches? Another function I'd like to see based on this work: expandable nestable function mapping. E.g., \tl_nest_map_function:nN {ab{cd{e}f}g} \foo:n resulting in (whitespace/newlines inserted for clarity) \foo:n{a} \foo:n{b} { \foo:n{c} \foo:n{d} { \foo:n{e} } \foo:n{f} } \foo:n{g} It's easy to write \tl_nest_map_function:nN that *almost* works (see attached), but it drops braces around single tokens, which isn't always appropriate. (I haven't looked into doing it non-expandably, which would be more robust.) Cheers, -- Will \documentclass{article} \usepackage{expl3} \begin{document} \ExplSyntaxOn \cs_new:Npn \tl_nest_map_function:nN #1#2{ \tl_nest_map_function_aux:Nn #2 #1 \q_recursion_tail \q_recursion_stop } \cs_new:Npn \tl_nest_map_function_aux:Nn #1#2{ \quark_if_recursion_tail_stop:n{#2} \tl_if_single:nTF {#2} { #1{#2} } { {\tl_nest_map_function:nN {#2} #1 } } \tl_nest_map_function_aux:Nn #1 } \cs_new_nopar:Npn \tl_nest_map_function:NN #1#2{ \exp_after:wN \tl_nest_map_function_aux:Nn \exp_after:wN #2 #1 \q_recursion_tail \q_recursion_stop } \cs_new:Npn \tl_nest_replace:Nnn #1#2#3 { \cs_set:Npn \tl_tmp:n ##1 { \tl_if_eq:NNTF ##1 #2 { \exp_not:n {#3} } { \exp_not:n {##1} } } \tl_set:Nx #1 {\tl_nest_map_function:NN #1 \tl_tmp:n} } \def\1{abc{def}ghi{j{k}l}} \tl_nest_replace:Nnn \1 {e} {E} \tl_nest_replace:Nnn \1 {k} {K} \show\1 \end{document}