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 p2B3807o029795 for ; Fri, 11 Mar 2011 04:08:01 +0100 Received: (qmail 7826 invoked by alias); 11 Mar 2011 03:07:55 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 11 Mar 2011 03:07:55 -0000 Received: from relay2.uni-heidelberg.de (EHLO relay2.uni-heidelberg.de) [129.206.210.211] by mx0.gmx.net (mx003) with SMTP; 11 Mar 2011 04:07:55 +0100 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 p2B35FnT008948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 11 Mar 2011 04:05:15 +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 p2AN14wR008315; Fri, 11 Mar 2011 04:04:56 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1206370 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 11 Mar 2011 04:04:56 +0100 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 p2B34uDg028350 for ; Fri, 11 Mar 2011 04:04:56 +0100 Received: from mail-yi0-f49.google.com (mail-yi0-f49.google.com [209.85.218.49]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p2B34prS008843 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Fri, 11 Mar 2011 04:04:55 +0100 Received: by yic15 with SMTP id 15so1710930yic.22 for ; Thu, 10 Mar 2011 19:04:50 -0800 (PST) MIME-Version: 1.0 Received: by 10.146.98.3 with SMTP id v3mr4435676yab.36.1299812598492; Thu, 10 Mar 2011 19:03:18 -0800 (PST) Received: by 10.146.82.5 with HTTP; Thu, 10 Mar 2011 19:03:17 -0800 (PST) References: <905C5ED0-6639-4DEB-95AC-A2FCB2C4491D@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 X-Spam-Whitelist: Message-ID: Date: Thu, 10 Mar 2011 22:03:17 -0500 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Bruno Le Floch Subject: Re: expl3's seq_pop_right etc. To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <905C5ED0-6639-4DEB-95AC-A2FCB2C4491D@gmail.com> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p77e5KAPs1l6v/Sb97LojnDtMgfETrECMLUO9erHzOJe+OynZRhvlGqb5A0X bbiCt2rAnnct/NAlbHMvoAL6GY+23tB3khNK7bp7qqSbssdDTHsQd8+gWzfjr4OMj5ambWQGofKK 3vIsQ==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: 6666 > With all this in mind, I'd like to invite comments on the functions offered > (perhaps an f-expandable \seq_get_(left/right):N would also be a good idea? > Contributions welcome.) and the particular implementation I've chosen below. > After any discussion here I'll add the functions (with tests) to expl3. I'll give a try to various variants f-/x-/non-expandable this weekend, and benchmark them. Do we care about keeping braces surrounding an element in a sequence (I'd say yes, although it requires more care)? -- Bruno On 3/9/11, Will Robertson wrote: > Dear all, > > Quite some time ago Morten and I were discussing improvements to the > functions offered by the "seq" module in expl3, namely to make symmetric the > push and pop commands so you could access them on both sides if you wished. > (Obviously, perhaps, it's more efficient to do things on the left, however.) > > The idea is that where the seq module currently offers > > PUT LEFT \seq_put_left, \seq_push (synonyms) > PUT RIGHT \seq_put_right > POP LEFT \seq_pop:NN > POP RIGHT > GET LEFT \seq_get:NN, \seq_top:NN (synonyms) > GET RIGHT > > we would augment/rename these functions as follows: > > PUT LEFT \seq_put_left, \seq_push > PUT RIGHT \seq_put_right > POP LEFT \seq_pop_left:NN, \seq_pop:NN > POP RIGHT \seq_pop_right:NN > GET LEFT \seq_get_left:NN, \seq_get:NN > GET RIGHT \seq_get_right:NN > > I've finally taken some minutes to write out some functions that fill in > these gaps. > > There are a few design decisions that I've chosen to delay -- e.g., should > we be aiming for more expandable functions for dealing with sequences? My > thoughts are that it's probable that expandable functions are faster for > shorter lists and slower for longer ones, although I haven't done any > benchmarking. So my first reaction is to do everything expandably with comma > lists but un-expandably with sequences. However, my implementation actually > does use the mapping approach since we've got that conveniently set up with > quarks already. Happy to discuss. > > With all this in mind, I'd like to invite comments on the functions offered > (perhaps an f-expandable \seq_get_(left/right):N would also be a good idea? > Contributions welcome.) and the particular implementation I've chosen below. > After any discussion here I'll add the functions (with tests) to expl3. > > In lieu of code comments, a rough description: sequences are mapped two > elements at a time until the end of the sequence is reached. For the > pop_right:NN operations, a new sequence is put_right into until the final > element is found and omitted but stored in a token list. For the get_right > operations, we simply save the final element in a token list. There is also > a pop_right:N function offered that does not store the popped element. > > Best regards, > -- Will > >