Received: from mail.proteosys.com ([213.139.130.197]) by nummer-3.proteosys with Microsoft SMTPSVC(6.0.3790.3959); Tue, 4 Aug 2009 01:44:54 +0200 Received: by mail.proteosys.com (8.14.3/8.14.3) with ESMTP id n73Nis49030380 for ; Tue, 4 Aug 2009 01:44:54 +0200 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id n73Ne3w6018619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 Aug 2009 01:40:03 +0200 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 n73M1Bpl011091; Tue, 4 Aug 2009 01:39:59 +0200 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 15.5) with spool id 293413 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 4 Aug 2009 01:39:59 +0200 Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id n73Ndw78018177 for ; Tue, 4 Aug 2009 01:39:59 +0200 Received: from av8-1-sn3.vrr.skanova.net (av8-1-sn3.vrr.skanova.net [81.228.9.183]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id n73NdbnV018495 for ; Tue, 4 Aug 2009 01:39:40 +0200 Received: by av8-1-sn3.vrr.skanova.net (Postfix, from userid 502) id 47FD837F23; Tue, 4 Aug 2009 00:36:42 +0200 (CEST) Received: from smtp3-1-sn3.vrr.skanova.net (smtp3-1-sn3.vrr.skanova.net [81.228.9.101]) by av8-1-sn3.vrr.skanova.net (Postfix) with ESMTP id 11D9D37E52 for ; Tue, 4 Aug 2009 00:36:42 +0200 (CEST) Received: from Kuben.local (90-230-192-94-no86.tbcn.telia.com [90.230.192.94]) by smtp3-1-sn3.vrr.skanova.net (Postfix) with ESMTP id 064D737E44 for ; Tue, 4 Aug 2009 00:36:39 +0200 (CEST) User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 References: <4A720566.80504@morningstar2.co.uk> <5BD2F1CD-3A4D-4204-889D-7E7CDA38F364@gmail.com> <4A740307.5000703@morningstar2.co.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by listserv.uni-heidelberg.de id n73Ndx78018178 Message-ID: <4A77667A.5080400@residenset.net> Date: Tue, 4 Aug 2009 00:36:42 +0200 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: =?ISO-8859-1?Q?Lars_Hellstr=F6m?= Subject: Re: \tl_add_braces:N ? To: LATEX-L@LISTSERV.UNI-HEIDELBERG.DE In-Reply-To: <4A740307.5000703@morningstar2.co.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-ProteoSys-SPAM-Score: -6.599 () BAYES_00,RCVD_IN_DNSWL_MED X-Scanned-By: MIMEDefang 2.65 on 213.139.130.197 Return-Path: owner-latex-l@LISTSERV.UNI-HEIDELBERG.DE X-OriginalArrivalTime: 03 Aug 2009 23:44:54.0907 (UTC) FILETIME=[66FD44B0:01CA1494] Status: R X-Status: X-Keywords: X-UID: 5804 Joseph Wright skrev: > Will Robertson wrote: >> What sort of circumstances are you running into this? (Just out of >> curiousity.) > > This tends to be when constructing a list of tokens to possibly be added > to something like \frac or sub/superscripted. The token list is built > up, then I need to wrap it up in braces so that whatever function I'm > applying to it works correctly. As far as possible, I'm keen to make > the token lists I use end up the same as if they'd been done by hand: it > makes debugging a lot easier. For example: > > \tl_set:Nn \l_tmpa_tl { abc } > \tl_set:Nn \l_tmpb_tl { def } > \tl_put_right:NV \l_tmpa_tl \l_tmpb_tl > \tl_set:No \l_tmpa_tl { > \exp_after:wN { \l_tmpa_tl } > } > \tl_put_left:Nn \l_tmpa_tl { 10 ^ } > > to end up with 10^{abcdef} in \l_tmpa_tl. Hmm... IMHO, the awkwardness here is partly due to using a list-oriented API to construct what really is a tree (even though we must _store_ it in linearised form, as a list). In order to respect this tree structure, I'd probably rather do the last two steps as \def\l_tmpa#1{ \def\l_tmpa_tl{10^{#1}} } \expandafter\l_tmpa \expandafter{ \l_tmpa_tl} % Or use \exp_args:No if you pardon the primitives[*]. Of course, if the material isn't fragile -- the given example isn't -- then a single (protected) \edef is even simpler. Lars Hellström [*] I'm starting to doubt I'll ever manage a transition to l3names, myself... Sure, some parts are really nifty, but other parts seem bent on establishing a computational model for LaTeX that I'm not quite comfortable with. Taking the above as example, I realise that one sometimes want operations that are precisely \tl_put_left:Nn or \tl_put_right:Nn, but those don't come naturally to TeX, solidly imperative that they are. When used for general programming, TeX tends to be better served by a functional/scripting/dynamic approach than an imperative one, but I suppose it is hard to show this off in the l3 documentation; since the scripting style doesn't suggest the creation of large libraries of "standard operations", someone who checks the list of available commands will mostly see the imperative stuff. :-(