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 p2DMH8mJ020171 for ; Sun, 13 Mar 2011 23:17:09 +0100 Received: (qmail 26767 invoked by alias); 13 Mar 2011 22:17:03 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 13 Mar 2011 22:17:03 -0000 Received: from relay2.uni-heidelberg.de (EHLO relay2.uni-heidelberg.de) [129.206.210.211] by mx0.gmx.net (mx021) with SMTP; 13 Mar 2011 23:17:03 +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 p2DMEpFx029056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 13 Mar 2011 23:14:51 +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 p2DAHdWg014519; Sun, 13 Mar 2011 23:14:50 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1209096 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Sun, 13 Mar 2011 23:14:50 +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 p2DMEouT022953 for ; Sun, 13 Mar 2011 23:14:50 +0100 Received: from mail-gy0-f177.google.com (mail-gy0-f177.google.com [209.85.160.177]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p2DMEiPL029039 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=FAIL) for ; Sun, 13 Mar 2011 23:14:48 +0100 Received: by gyd12 with SMTP id 12so1235245gyd.22 for ; Sun, 13 Mar 2011 15:14:44 -0700 (PDT) Received: by 10.236.182.231 with SMTP id o67mr5620424yhm.344.1300054484228; Sun, 13 Mar 2011 15:14:44 -0700 (PDT) Received: from [10.0.1.105] (114-30-104-175.ip.adam.com.au [114.30.104.175]) by mx.google.com with ESMTPS id 27sm2721340yhl.25.2011.03.13.15.14.41 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 13 Mar 2011 15:14:43 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) References: <905C5ED0-6639-4DEB-95AC-A2FCB2C4491D@gmail.com> 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 p2DMEouT022954 Message-ID: <935A1EA2-C971-4A3A-8DF4-6F890E0CFB32@gmail.com> Date: Mon, 14 Mar 2011 08:44:37 +1030 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Will Robertson Subject: Re: expl3's seq_pop_right etc. 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=5D7Q89H36p4WX0t+AtsdW2ORvUlAfcdS0skAdU0CyDpncVxtUMPpOqI3gH81aZIXD1cH3 5ETx5RtA06hG3EktnRGhfE2oxt+RU0e7F8YpJ9eB28exjgx7xl4PJV7d6l42PTMYFOttFGsL2SlK x2C0A==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: 6671 Hi Bruno, Great work! On 14/03/2011, at 6:44 AM, Bruno Le Floch wrote: > The only reason to not brace items is to be able to find an item > faster using delimited arguments, and that this will only work for > "nice" items (i.e., no brace, no `#`). I was aware that the \seq_if_in functions had this restriction, but I didn't realise the internal structure of the seq was chosen for this reason; IMO braces turn up far too easily in input text to restrict them from such a data structure. (Imagine pushing a list of names to a stack, say, and someone is called "Hef{}feron"!) > So I have the following more > radical proposal: brace the arguments, and propose two searches, We like radical proposals :) > - one true search, which goes through each element and compares with > `\tl_if_eq:nn`, > > - a `str`-like one, which detokenizes the seq, and searches for the > detokenized version of `\seq_elt:n {}` with a delimited argument > (now ok, since everything is detokenized). > > That proposal would make the code much, much clearer in my opinion. > Also slightly faster, but not more than two-fold. I did a quick comparison, and it seems like the delimited-argument search is around about 10-20 times faster than mapping, even for relatively large seqs (several thousand (small) elements, which takes a surprisingly long time to create using \seq_push:Nn). So I'm generally in favour of this suggestion. But I wonder if there is some downside to using braces that I'm not experienced enough to see. (I can't think off the top of my head of another stack-like data structures in TeX that uses braces.) Can anyone comment further on this? -- Will