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 p0QDLMoG003639 for ; Wed, 26 Jan 2011 14:21:24 +0100 Received: (qmail 30610 invoked by alias); 26 Jan 2011 13:21:17 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 26 Jan 2011 13:21:16 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx090) with SMTP; 26 Jan 2011 14:21:16 +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 p0QDJ54l009372 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 26 Jan 2011 14:19:06 +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 p0QD5uVN001609; Wed, 26 Jan 2011 14:18:58 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 940455 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Wed, 26 Jan 2011 14:18:57 +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 p0QDIvSl024736 for ; Wed, 26 Jan 2011 14:18:57 +0100 Received: from g1t0027.austin.hp.com (g1t0027.austin.hp.com [15.216.28.34]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id p0QDId5V008373 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 26 Jan 2011 14:18:44 +0100 Received: from G3W0631.americas.hpqcorp.net (g3w0631.americas.hpqcorp.net [16.233.59.15]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by g1t0027.austin.hp.com (Postfix) with ESMTPS id 9504638741 for ; Wed, 26 Jan 2011 13:18:38 +0000 (UTC) Received: from G4W1852.americas.hpqcorp.net (16.234.97.230) by G3W0631.americas.hpqcorp.net (16.233.59.15) with Microsoft SMTP Server (TLS) id 8.2.176.0; Wed, 26 Jan 2011 13:18:16 +0000 Received: from GVW1086EXB.americas.hpqcorp.net ([16.234.42.2]) by G4W1852.americas.hpqcorp.net ([16.234.97.230]) with mapi; Wed, 26 Jan 2011 13:18:16 +0000 Thread-Topic: \clist_length:N and \clist_nth:N Thread-Index: Acu9W31eR1lwE8q4TAKaF/a1lunv3w== References: <3986.1295947424@cl.cam.ac.uk> Accept-Language: de-DE, en-US Content-Language: de-DE acceptlanguage: de-DE, en-US Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by listserv.uni-heidelberg.de id p0QDIvSl024737 Message-ID: Date: Wed, 26 Jan 2011 13:19:02 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: "Mittelbach, Frank" Subject: Re: \clist_length:N and \clist_nth:N To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: <3986.1295947424@cl.cam.ac.uk> Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (Mail was not recognized as spam); Detail=5D7Q89H36p4WX0t+AtsdWzrXATe7U7iyEYsVEub6UEScnitTuLsF1TdlrkUKNRhypl1WP P4z9N2hLfJzsGszrlv+ygay/ivx19oyBwO3NEg0raNb/3tCvONPdaWhG3fyrhob4EvcA0r7m4G7q eqN5w==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: 6574 I don't have any issue with element or elt (having been exposed to lisp long time ago) but my feeling is that "length" is rather a good name for the concept, but then we should use it in other places too and get rid of elt_count there. For _nth I think _element is ok, but I'm not so sure why _item would be bad. Don't see that there would be a conflict with other "items" of LaTeX. In fact it is the same concept, so why choose different names? Frank ... written on the iPad Am 25.01.2011 um 10:37 schrieb "Robin Fairbairns" : > Joseph Wright wrote: > >> 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' :-) > > in some ways of looking at a list, it has 'length'. > > in plain english, i would say lists have "items" (or just "things") > rather than "elements", but "item" is already heavily overloaded in > the user's level latex-ese. i don't have a problem with "element" (or > "elt" in command names). > >>> 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. > > the "lisp heritage" is no more than simple use of some lisp names for > some latex internal operations (e.g., car, cdr). it's a long time (>40 > years) since i learned lisp, but i don't remember a special name for > items in a lisp list. > >>>> 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. > > hmm. index works, but i don't think it supports the "plain english" test. > >> I'd imagine 'index' to be the other way around: >> >> \clist_index:Nn \l_some_clist { item } => Number > > agreed. > >> 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.) > > i think element is as good as it gets, in this context. > >>> 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 :-) > > robin > > getting better every day. very slightly.