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 p0P8np0k005284 for ; Tue, 25 Jan 2011 09:49:52 +0100 Received: (qmail 16463 invoked by alias); 25 Jan 2011 08:49:46 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 25 Jan 2011 08:49:45 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx002) with SMTP; 25 Jan 2011 09:49:45 +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 p0P8lXVh026323 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Jan 2011 09:47:33 +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 p0P8JB32029812; Tue, 25 Jan 2011 09:47:19 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 860048 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Tue, 25 Jan 2011 09:47:19 +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 p0P8lJsF019588 for ; Tue, 25 Jan 2011 09:47:19 +0100 Received: from ueamailgate01.uea.ac.uk (ueamailgate01.uea.ac.uk [139.222.131.184]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p0P8l0Qc024959 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 25 Jan 2011 09:47:04 +0100 Received: from ueams01.uea.ac.uk (ueams01.uea.ac.uk [139.222.131.78]) by ueamailgate01.uea.ac.uk (8.13.8/8.13.8) with ESMTP id p0P8kx6L030650 for ; Tue, 25 Jan 2011 08:46:59 GMT Received: from [139.222.115.165] by ueams01.uea.ac.uk with esmtp (Exim 4.69) (envelope-from ) id 1PheYD-0005vw-Ag; Tue, 25 Jan 2011 08:46:57 +0000 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 References: <201101230906.p0N96bln024353@comedy.dante.de> <4D3D8628.1000502@residenset.net> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN, outgoing) X-CanIt-Geo: ip=139.222.131.78; country=GB; region=I9; city=Norwich; latitude=52.6333; longitude=1.3000; http://maps.google.com/maps?q=52.6333,1.3000&z=6 X-CanItPRO-Stream: UEA:outgoing (inherits from UEA:default,base:default) X-Canit-Stats-ID: 68086211 - 6bc0c42dd100 - 20110125 X-Scanned-By: CanIt (www . roaringpenguin . com) on 139.222.131.184 Message-ID: <4D3E8E04.8000802@morningstar2.co.uk> Date: Tue, 25 Jan 2011 08:47:00 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: Joseph Wright Subject: Re: \clist_length:N and \clist_nth:N To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <4D3D8628.1000502@residenset.net> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p6i75npGen84eVAEFK/syJmFuaL1OLtauwJ5R/kaZ9HAe8peGX1DeqJL7BW4 1X28hmBsSaikXt0ebYfUaHmtXkk7HChP+4IT8uNdVgNwDH5hrhnvoJ4U9x3qC9CkHcMikBVzVkV0 aKFtQ==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: 6571 On 24/01/2011 14:01, Lars Hellström wrote: > Isn't this "elt" an implementation detail for that type of list (various > \@elt tokens in 2e come to mind), and thus something that should be kept > internal rather than canonised in a public interface? The clean solution > for *both* types of list is rather to use "length". Seems reasonable: one would normally talk about 'a long list of things to do', so lists to have 'length' :-) > Moreover, I get a vague impression that the term `elt' is part of the > pseudo-LISP heritage of LaTeX (emphasis on the "La"). If so, then that > is IMHO another reason to avoid it, as that heritage is full of square > pegs trying to fit in round holes. Not being familiar with Lisp, I can only go on things like LaTeX2e's \@cdr, etc., which have much more sensible names in expl3. >> I didn't write "clist_nth" with a view of it being the permanent name, >> but >> now that I've written it I can't think of a (good) alternative. Any >> thoughts? > > I think the verb you're looking for is "index", i.e., the command name > would be clist_index. I'd imagine 'index' to be the other way around: \clist_index:Nn \l_some_clist { item } => Number whereas what Will has implemented gives the 'entry', 'element', 'item' or some such name. ('element' seems to be discouraged based on the first part of your e-mail, so perhaps 'item' is better.) > first: Return index of first occurrence of a particular item within a > clist, > or -1 (given 0-based indices) if the item does not occur therein. > last: Return index of last occurrence of a particular item within a > clist, > or -1 (given 0-based indices) if the item does not occur therein. > (Note: Slightly trickier to implement.) Both of these look relatively easy to do. > range: Return a subrange of the clist, i.e., if \a_clist is "a,b,c,d" then > \clist_range:Nnn\a_clist{1}{2} returns "b,c". (I don't have an > opinion as to what might be the best sense of "return" in this > case.) > replace: Replace the material in a subrange of the clist by some other > clist material. More tricky. Let's sort the others first :-) -- Joseph Wright