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 p2IK92g4003340 for ; Fri, 18 Mar 2011 21:09:03 +0100 Received: (qmail 32326 invoked by alias); 18 Mar 2011 20:08:57 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 18 Mar 2011 20:08:56 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx080) with SMTP; 18 Mar 2011 21:08:56 +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 p2IK6eD9014141 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Mar 2011 21:06:40 +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 p2IGbgmn011272; Fri, 18 Mar 2011 21:06:29 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1234623 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 18 Mar 2011 21:06:29 +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 p2IK6ThN030679 for ; Fri, 18 Mar 2011 21:06:29 +0100 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p2IK6Pkl028172 for ; Fri, 18 Mar 2011 21:06:28 +0100 Received: from morse.mittelbach-online.de (p54A830AF.dip.t-dialin.net [84.168.48.175]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LtlMD-1PsbLx1uw1-0115y0; Fri, 18 Mar 2011 21:06:24 +0100 Received: by morse.mittelbach-online.de (Postfix, from userid 501) id 58AA27227B; Fri, 18 Mar 2011 21:06:21 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <905C5ED0-6639-4DEB-95AC-A2FCB2C4491D@gmail.com> <935A1EA2-C971-4A3A-8DF4-6F890E0CFB32@gmail.com> <5256FD2C-CD53-4FF0-A405-5B8B2781E5EC@gmail.com> <19843.17637.935263.780194@morse.mittelbach-online.de> X-Mailer: VM 7.19 under Emacs 21.3.1 X-Provags-ID: V02:K0:bLGyEinI6nEp/ZEZdfnmHSWXYHVj0jBZ1lQ197+nh75 ddS3JsIqVgaFsZeEd5MIqw5xAmbV3ZWJM4lxNRuhIFOcaHTEJ0 eUZ/8MnK9sN2o3qJfBe0lcWX+GIF+bzAnwX82KTmhESlL9Bxrr CA6cFhvvQOK4vkJ1oPyMnAm3TgfeTrdgubDX6bDboBNfqLXa7t aDExpUfCOX/tI3Qag/+Gg== X-Spam-Whitelist-Provider: Message-ID: <19843.47932.785350.652072@morse.mittelbach-online.de> Date: Fri, 18 Mar 2011 21:06:20 +0100 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Frank Mittelbach 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=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: 6689 Bruno, > To be clear, I'm perfectly ready to keep the old interface. I was > mostly concentrating on the implementation, and some functions > appeared more natural than the existing ones in that context. I'm not saying that the old interfaces need to stay or should stay, only that it is helpful if they do at least initially. And the discussion so far shows (and showed in the past) that there are improvements possible. By the way, with the interfaces but back in the compatibility section shows some failures in some files that need checking. Not really got around checking for cause. xor certainly dies because some of its code misuses the seq implementation and hacks into \seq_elt:w so not surprising this dies. For others I don't know yet. > > > Then there is the issue of l3candidates, which I have not > > > re-programmed yet, as well as the quicksort defined in l3prg.dtx > > > > one step at a time i'd say. > > I meant that there are some \seq_from_clist and \clist_from_seq > functions in l3candidates which will have to be rewritten, and a > \seq_quicksort, or something like that, which I haven't looked at. I'm > _definitely not_ rewriting l3prg.dtx :). you are not? :-) pity. But this is what I meant: none of these are on the critical path. So I was just agreeing with you that there is no need to rewrite them just to experiment with a new seq implementation. Of course if we decide to adopt it, then we need to do those rewrites, eventually. > > > - I don't like the fact that \seq_(g)pop return its value locally, so > > > I changed which functions are provided there to \seq_pop_with:Nn > > > {}. > > > > Im not sure here. > > > > - the general design principle is that all functions that get values from > > some data structure *always* store them *locally* in a variable. > > > > - the data structure itself could be local or global and a manipulation of > > the structure could then be local or global too. > > Is there any example of data structure other than seq or prop? not much at the moment in terms of kernel data structures, only clists I think. But for the outputroutine and the like I guess you will have other complex data structures from which you need to pick up values. > > > > On the other hand popping + using the value is a quite common usage, so to > > have to always write > > > > \seq_pop_left_with:Nn \l_foo_seq {\tl_set:Nn \l_bar_tl} > > > > instead of > > > > \seq_pop:NN \l_foo_seq \l_bar_tl > > I see your point. Then perhaps renaming \seq_pop_left_with:Nn to > \seq_pop_left_do:Nn, and leaving \seq_pop:NN as it is could make > sense. Then if we just want to remove the left-most element and apply > some function onto it, we can do > > \seq_pop_left_do:Nn \l_foo_seq {\foo:nn {}} > > and to get a global return value we would do > > \seq_pop_left_do:Nn \l_foo_seq {\tl_gset:Nn \g_foo_tl} > > Basically, I'm just making an auxiliary function available to the user. I must say I rather like \seq_pop_left_with:Nn as a generic approach. It is just that I don't want to drop the function that one normally needs for it. And I rather prefer the _pop_with to _pop_do. As to the naming, of course one could go for \seq_get_pop:NN or even \seq_get_pop_left:NN and then one could have all variations without any ambiguity to what is local and global, eg \seq_gget_pop:NN \seq_get_gpop:NN \seq_gget_gpop:NN perhaps that's better but I'm not sure if it is not just making things longer > > > now having written that I noticed that it isn't true, this is violated in > > l3prop where there are gget functions for key values, so hmmm ... still I > > tend towards the rule above I guess > > I think that you are right: there should be a \..._pop_left:NN, which > does something consistent between the various data structures. > Choosing local return values is as good as anything. Well I'm not too sure myself here, the discussion is certainly helpful > > > - I'd like every "..._map_function:NN" to become > > > "..._map_function:Nn", i.e. allow mapping several tokens at a time. It > > > > Personally I don't find this very intuitive; if you map a function you > > map a function name and that would mean N. Besides you would lose the > > ability to map a constructed function name ie "c" though that is > > something you would seldom need I guess. > > My initial application was to be able to map a function with two > arguments on two seq and at the same time. First I zipped the > two seq into one seq whose item each have the form {}{}. > Then I could map _expandably_ > > \seq_map_function:Nn \l_foo_zipped_seq {\exp_after:wN \foo_func:nn \use:n} > > where the \use:n unbraces its argument. Not a very convincing use. No not really :-) if it is a serious use I would probably encapsulate it by its own functions and then use those, but anyway ... > But Lars Madsen's examples with { \foo_func:nn {arg1} } are better. yes probably > > I would rather do > > > > \cs_new:Npn \map_func:n #1 { \func:n #1} > > ...map_function:NN \l_foo_seq \map_func:n > > That would be better as > > ...map_inline:Nn \l_foo_seq { \func:n {#1}} > > The key here is expandability. When it is not needed, map_inline:Nn > and map_variable:NNn fit the bill nicely. The best might be to leave > both the :NN and :Nn variants, synonyms of each other, hence taking > little of TeX's memory. probably. > There is also the question of whether removing an elements once/all > copies of it should be named as in l3clist or l3tl: > > \clist_remove_element:Nn > \tl_remove_all_in:Nn > \tl_remove_in:Nn > > I'd go for the tl version. agreed some concistency in the naming would be in order. About the actual names to use I'm not so sure. Must confess I wasn't aware of the tl ones at all. The _in seems to me unnecessary and I would personally prefer \tl_remove_once:Nn \tl_remove_all:Nn etc. cheers frank