digitalmars.D - Please vote once and for good: range operations
- Andrei Alexandrescu (53/53) Jan 28 2009 It looks like there is endless debate on the naming convention for the
- Bill Baxter (7/10) Jan 28 2009 Looking for bugs is too much like work. :-P
- Andrei Alexandrescu (3/17) Jan 28 2009 Oh. I thought voting would mean replying to my message with your vote.
- Bill Baxter (10/31) Jan 28 2009 You're just likely to get a much better voter turn-out if you make it
- Jarrett Billingsley (5/11) Jan 28 2009 Or more concisely, lst[-1].
- dsimcha (17/66) Jan 28 2009 http://merd.sourceforge.net/pixel/language-study/syntax-across-languages...
- Robert Fraser (4/9) Jan 28 2009 Java's Deque class uses first() and last(). A Java iterator uses next()....
- Chad J (7/11) Jan 28 2009 As for voting rules, I suggest we all write down a list of pairs that
- Sandeep Kakarlapudi (2/2) Jan 28 2009 Not sure if this vote is meant for regular members only or not! Here's m...
- Steven Schveighoffer (4/7) Jan 28 2009 Please post with your official D fan club id number for your vote to be
- Sandeep Kakarlapudi (3/15) Jan 28 2009 Here's my id: 0xD
- Chad J (18/18) Jan 28 2009 These are all fine to my eyes:
- Chad J (2/22) Jan 28 2009 alpha/omega
- Saaa (2/3) Jan 28 2009 head/toe seem different classes to me, rather head/back if fore/aft isn'...
- John Reimer (8/13) Jan 28 2009 Probably not wise for me to quibble over these points, but... to me, th...
- Saaa (1/7) Jan 29 2009 :D I have the same with 'head'
- John Reimer (3/13) Jan 29 2009 Yeah, I guess it works both ways. :)
- Steven Schveighoffer (22/24) Jan 28 2009 C# doesn't seem to have bi-directional ranges. Only forward ones. In a...
- Andrei Alexandrescu (8/17) Jan 28 2009 While searching various language samples/standard libs, I couldn't stop
- Steven Schveighoffer (13/22) Jan 28 2009 It is a pain, when coming from C++ which has the very impressive STL. O...
- Jason House (11/78) Jan 28 2009 I had hoped that the endless debate on naming when you first proposed ra...
- Tiago Carvalho (4/57) Jan 28 2009 First, Last simply make sense to me. Head would be nice to, but Toe just...
- Robert Fraser (6/6) Jan 28 2009 In order of preference...
- Simen Kjaeraas (4/6) Jan 28 2009 Do let's. My first vote goes to first/last, with head/toe at second plac...
- Andrei Alexandrescu (12/22) Jan 28 2009 Ok, after looking at my code I discovered a huge problem with "first".
- John Reimer (4/33) Jan 28 2009 It can walk the plank on the starboard side. :)
- Brad Roberts (3/32) Jan 28 2009 Just to toss my 2cents into the hat, I'll introduce a new pair:
- Bill Baxter (9/31) Jan 28 2009 Can't you just think of it as the first of the range, not the first of
- Andrei Alexandrescu (8/40) Jan 28 2009 I could, if "next" weren't called "next". If the current is called
- Bill Baxter (7/57) Jan 28 2009 But unless you've got some new words to add, we've listed pretty much
- Michel Fortin (25/34) Jan 29 2009 I think "first/last" goes well with "advance/retreat".
- Andrei Alexandrescu (4/23) Jan 29 2009 Hehe, this argument works in my favor. Advancing means making a number
- Joel C. Salomon (6/8) Jan 29 2009 Has =93current=94 been suggested?
- Andrei Alexandrescu (6/19) Jan 29 2009 Current and curr have been suggested. I was only looking at two terms
- Ary Borenszweig (8/34) Jan 28 2009 Shouldn't the user think the same with "head" or "front"?
- Yigal Chripun (20/43) Jan 28 2009 I like the following from Chad's list:
- Vladimir Panteleev (8/27) Jan 29 2009 I don't think that "next" is an appropriate name here. Since it is an
- John Reimer (7/71) Jan 28 2009 head/last. I consider it symmetrical in the context of use, because in ...
- Sean Kelly (4/4) Jan 28 2009 head/last
- Kyle Furlong (2/9) Jan 29 2009 This. +1
- Nick Sabalausky (13/13) Jan 28 2009 I'd be ok with any of these:
- BCS (2/6) Jan 28 2009 Wow I actuly like something C++ did. vote++
- Bill Baxter (4/10) Jan 28 2009 I could go for front/back too.
- Brian Hay (2/2) Jan 28 2009 I don't agree that "first must go". I vote:
- BLS (3/3) Jan 28 2009 C++:
- Daniel Keep (9/9) Jan 28 2009 Ideally, I'd like to change all the names for the interface to be:
- Daniel Keep (2/5) Jan 28 2009 *ONCE*... as Walter ONCE espoused...
- Bill Baxter (6/7) Jan 28 2009 I think that's exactly the kind of thing he meant to avoid. Now you hav...
- Daniel Keep (13/24) Jan 29 2009 Thing is that most of the time, I'm more interested in testing to see if
- Bill Baxter (5/28) Jan 29 2009 :-) Ok. .more, .hasMore, .remains, .hasFront, something of that ilk
- Michel Fortin (13/18) Jan 29 2009 What I'd like is to place directly the range in the conditional
- Steven Schveighoffer (4/11) Jan 29 2009 That has a negative term right in it "non". Why do people consider empt...
- Daniel Keep (8/24) Jan 29 2009 Well, if someone were to call you "empty-headed" in an outrageous French
- Steven Schveighoffer (17/39) Jan 29 2009 I'd probably wait until they taunt me a second time, then sneek into the...
- Rainer Deyke (7/10) Jan 29 2009 I like this. Verb instead of noun for action, unambiguous about which
- Kazuhiro Inaba (9/9) Jan 28 2009 I'd like to vote for
- Max Samukha (7/60) Jan 28 2009 head/toe (I'm not a native speaker, so this sounds perfectly good to
- bearophile (10/16) Jan 28 2009 'e'
- grauzone (1/1) Jan 29 2009 head/tail > first/last
- Derek Parnell (29/30) Jan 29 2009 Before doing so, can I ask for a clarification, naming what *exactly* ar...
- Rioshin an'Harthen (4/7) Jan 29 2009 I'll vote for
- Don (12/14) Jan 29 2009 head/toe > front/back >> all the other suggestions >> car.
- Brian Hay (3/5) Jan 29 2009 I disagree. Start and end can be both nouns or verbs. First and last are...
-
Don
(9/15)
Jan 29 2009
Yes. You can also "front up to something" and "back into somebody"
. - Gide Nwawudu (2/2) Jan 29 2009 front/back is my preferred, but first/last, head/tail are ok.
- Michel Fortin (7/7) Jan 29 2009 I don't mind much about the names for head and toe. Anything that makes
- Denis Koroskin (5/22) Jan 29 2009 I don't like first/last. Given a sequence, its first and last elements a...
- Denis Koroskin (6/13) Jan 29 2009 I don't think head/tail gives any confusion (it certainly doesn't to me)...
- Brian (4/10) Jan 29 2009 front/back
- Yigal Chripun (3/13) Jan 29 2009 pinky/theBrain
- Denis Koroskin (2/36) Jan 29 2009 Agree, "advance" would be a better name, though (imo).
- Chad J (12/48) Jan 29 2009 Same, it seems BETTER. Though, it seems like it's suboptimal as well.
- Daniel Keep (5/22) Jan 29 2009 That's why I suggested "advanceFront" and "retreatBack." I don't think
- Joel C. Salomon (3/9) Jan 30 2009 How about =93chomp=94 and =93regurgitate=94? ;)
- Rainer Deyke (5/6) Jan 29 2009 1st pick: first/last
- Frits van Bommel (8/13) Jan 30 2009 first/last.
It looks like there is endless debate on the naming convention for the range operations. Few saw the obvious bugs in the documentation and examples :o). So please let's vote once and for all. I will note that I disagree we should ignore what conventions other languages have. Provincialism is the appurtenance of the incult. To that end, I looked around at how some languages define some primitives. LISP: car last http://www.gigamonkeys.com/book/they-called-it-lisp-for-a-reason-list-processing.html Scheme: car last http://merd.sourceforge.net/pixel/language-study/syntax-across-languages-per-language/Scheme.html ML: hd last http://www.standardml.org/Basis/list.html Ocaml: hd no last http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html Apparently Ocaml programmers tend to define their own function called "last": http://nodens.physics.ox.ac.uk/~mcdonnell/lab/code/code_ocaml/ocaml_fold/ocaml_fold.html http://caml.inria.fr/pub/ml-archives/caml-list/2004/04/06d65a793fa0503218c06783be2facbe.en.html Haskell: head last http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/head.html http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/last.html C++: front back http://support.microsoft.com/kb/158613 Scala: head last http://www.scala-lang.org/docu/files/api/scala/List.html Couldn't find after searching MS's asinine dox for 5 mins. Java: obj.get(0) obj.get(obj.size-1) http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractSequentialList.html Python: lst[0] lst[len(lst)-1] So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o). Andrei
Jan 28 2009
On Thu, Jan 29, 2009 at 9:26 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:It looks like there is endless debate on the naming convention for the range operations. Few saw the obvious bugs in the documentation and examples :o).Looking for bugs is too much like work. :-PSo please let's vote once and for all.Yes. Let's do. Please post a list of options for voting on and rules for the vote. (Multiple votes ok, not ok, points, negative votes allowed etc). --bb
Jan 28 2009
Bill Baxter wrote:On Thu, Jan 29, 2009 at 9:26 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Oh. I thought voting would mean replying to my message with your vote. AndreiIt looks like there is endless debate on the naming convention for the range operations. Few saw the obvious bugs in the documentation and examples :o).Looking for bugs is too much like work. :-PSo please let's vote once and for all.Yes. Let's do. Please post a list of options for voting on and rules for the vote. (Multiple votes ok, not ok, points, negative votes allowed etc). --bb
Jan 28 2009
On Thu, Jan 29, 2009 at 9:47 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Bill Baxter wrote:You're just likely to get a much better voter turn-out if you make it as simple as possible, multiple-choice style. Free form is ok by me though. I cast a vote for both: first/last and head/toe --bbOn Thu, Jan 29, 2009 at 9:26 AM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Oh. I thought voting would mean replying to my message with your vote. AndreiIt looks like there is endless debate on the naming convention for the range operations. Few saw the obvious bugs in the documentation and examples :o).Looking for bugs is too much like work. :-PSo please let's vote once and for all.Yes. Let's do. Please post a list of options for voting on and rules for the vote. (Multiple votes ok, not ok, points, negative votes allowed etc). --bb
Jan 28 2009
On Wed, Jan 28, 2009 at 7:26 PM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Python: lst[0] lst[len(lst)-1]Or more concisely, lst[-1].So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o).first/last would be my first choice. head/last would also be fine, and is in keeping with, uh pretty much everything else, it seems.
Jan 28 2009
== Quote from Andrei Alexandrescu (SeeWebsiteForEmail erdani.org)'s articleIt looks like there is endless debate on the naming convention for the range operations. Few saw the obvious bugs in the documentation and examples :o). So please let's vote once and for all. I will note that I disagree we should ignore what conventions other languages have. Provincialism is the appurtenance of the incult. To that end, I looked around at how some languages define some primitives. LISP: car lasthttp://www.gigamonkeys.com/book/they-called-it-lisp-for-a-reason-list-processing.htmlScheme: car lasthttp://merd.sourceforge.net/pixel/language-study/syntax-across-languages-per-language/Scheme.htmlML: hd last http://www.standardml.org/Basis/list.html Ocaml: hd no last http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html Apparently Ocaml programmers tend to define their own function called "last":http://nodens.physics.ox.ac.uk/~mcdonnell/lab/code/code_ocaml/ocaml_fold/ocaml_fold.htmlhttp://caml.inria.fr/pub/ml-archives/caml-list/2004/04/06d65a793fa0503218c06783be2facbe.en.htmlHaskell: head last http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/head.html http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/last.html C++: front back http://support.microsoft.com/kb/158613 Scala: head last http://www.scala-lang.org/docu/files/api/scala/List.html Couldn't find after searching MS's asinine dox for 5 mins. Java: obj.get(0) obj.get(obj.size-1) http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractSequentialList.html Python: lst[0] lst[len(lst)-1] So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o). AndreiTo me the most important thing is that it's symmetrical, i.e. don't use first, and then toe or head, and then last. My vote is for either front/back, first/last or head/toe (don't care which). All of the others are pretty bad for the following reasons: Lisp, Scheme: Car has absolutely no intuitive connection with the first part of anything. This terminology was probably invented by some 60's programmer who was seriously stoned. ML, OCaml, Haskell, Scala: Not symmetrical. Python: At least it looks nice, but anything that looks like array indexing should be used strictly for random access ranges. Java: Worse yet than array indexing, it looks like a lame substitute for an array index because Java's too stupid to support operator overloading.
Jan 28 2009
dsimcha wrote:Lisp, Scheme: Car has absolutely no intuitive connection with the first part of anything. This terminology was probably invented by some 60's programmer who was seriously stoned.Only sort of... http://en.wikipedia.org/wiki/Car_and_cdrJava: Worse yet than array indexing, it looks like a lame substitute for an array index because Java's too stupid to support operator overloading.Java's Deque class uses first() and last(). A Java iterator uses next(). So there's a bit of terminology.
Jan 28 2009
Andrei Alexandrescu wrote:So please let's vote AndreiAs for voting rules, I suggest we all write down a list of pairs that are acceptable to us on the aesthetic level. Each pair counts as a vote for that pair. So people get multiple votes, but never for the same pair. At the end hopefully you have a good metric of which pair is most acceptable. I'll post my list in a few minutes.
Jan 28 2009
Not sure if this vote is meant for regular members only or not! Here's my preference order anyways: first-last > head-rhead > head-tail > head-toe
Jan 28 2009
"Sandeep Kakarlapudi" wroteNot sure if this vote is meant for regular members only or not! Here's my preference order anyways: first-last > head-rhead > head-tail > head-toePlease post with your official D fan club id number for your vote to be counted. -Steve
Jan 28 2009
Steven Schveighoffer Wrote:"Sandeep Kakarlapudi" wroteHere's my id: 0xD :)Not sure if this vote is meant for regular members only or not! Here's my preference order anyways: first-last > head-rhead > head-tail > head-toePlease post with your official D fan club id number for your vote to be counted. -Steve
Jan 28 2009
These are all fine to my eyes: begin/end begin/terminus current/last current/rear current/back first/last fore/aft front/back left/right leftmost/rightmost head/last head/rear head/back start/end start/last start/terminus If any more come up that I like, I'll post those too.
Jan 28 2009
Chad J wrote:These are all fine to my eyes: begin/end begin/terminus current/last current/rear current/back first/last fore/aft front/back left/right leftmost/rightmost head/last head/rear head/back start/end start/last start/terminus If any more come up that I like, I'll post those too.alpha/omega
Jan 28 2009
fore/aft +head/toe seem different classes to me, rather head/back if fore/aft isn't going to win
Jan 28 2009
Hello Saaa,Probably not wise for me to quibble over these points, but... to me, the main problem with fore/aft is that it implies a position of an object that occupies physical space. Using something like head/last is just a little more abstract in the sense that it doesn't necessarily refer to physical position. Maybe it's time for me to stop thinking too hard on this. :D -JJRfore/aft +head/toe seem different classes to me, rather head/back if fore/aft isn't going to win
Jan 28 2009
Probably not wise for me to quibble over these points, but... to me, the main problem with fore/aft is that it implies a position of an object that occupies physical space. Using something like head/last is just a little more abstract in the sense that it doesn't necessarily refer to physical position. Maybe it's time for me to stop thinking too hard on this. :D:D I have the same with 'head'
Jan 29 2009
Hello Saaa,Yeah, I guess it works both ways. :) -JJRProbably not wise for me to quibble over these points, but... to me, the main problem with fore/aft is that it implies a position of an object that occupies physical space. Using something like head/last is just a little more abstract in the sense that it doesn't necessarily refer to physical position. Maybe it's time for me to stop thinking too hard on this. :D:D I have the same with 'head'
Jan 29 2009
"Andrei Alexandrescu" wroteCouldn't find after searching MS's asinine dox for 5 mins.case, they are enumerated over using an IEnumerator (or IEnumerator<T>, depending on whether you want generic support). In any case, the "head" element is the property "Current". In a container, you can only get the last element of something that has an indexer, and in that case, its: container[container.Count - 1]; of standard containers/algorithms anyways. It's one thing I don't like about it. references: http://msdn.microsoft.com/en-us/library/system.collections.ienumerator.current.aspx http://msdn.microsoft.com/en-us/library/ewthkb10.aspx In any case, I think front and back make the most sense to me. I did come from C++ however... I don't mind any of the normal choices (I don't count car as being 'normal'), but if Walter insists on keeping foreach_reverse, let's all remember that whatever is chosen for the rear/toe/last element of a range is going to be embedded in the compiler/spec, and essentially set in stone. -Steve
Jan 28 2009
Steven Schveighoffer wrote:of standard containers/algorithms anyways. It's one thing I don't like about it.While searching various language samples/standard libs, I couldn't stop noticing that .Net had the most childish concepts and the least appealing APIs and code samples. Looked like 21st century Visual Basic to me, only more verbose.I don't mind any of the normal choices (I don't count car as being 'normal')Hey, I have an idea: car and trailer! :o)but if Walter insists on keeping foreach_reverse, let's all remember that whatever is chosen for the rear/toe/last element of a range is going to be embedded in the compiler/spec, and essentially set in stone.Yah, I agree. Andrei
Jan 28 2009
"Andrei Alexandrescu" wroteSteven Schveighoffer wrote:It is a pain, when coming from C++ which has the very impressive STL. One of the things I absolutely hated is you cannot enumerate the elements in a hashtable and remove them as you enumerate (technically, D's builtin AA has this issue as well, but I have that ability in dcollections, and hopefully there will be a builtin range with that ability in the future *hint hint*). I have this really stupid piece of code where I enumerate through a lookup cache for finished threads, adding them to a list, then after enumerating through the hashtable, I have to remove them one at a time from the table by using the values I stored in the list, using a lookup each time to remove each element, when I could have removed them all without any extra penalty while traversing. -Steveterms of standard containers/algorithms anyways. It's one thing I don't like about it.While searching various language samples/standard libs, I couldn't stop noticing that .Net had the most childish concepts and the least appealing APIs and code samples. Looked like 21st century Visual Basic to me, only more verbose.
Jan 28 2009
Andrei Alexandrescu wrote:It looks like there is endless debate on the naming convention for the range operations.I had hoped that the endless debate on naming when you first proposed ranges was enough. You were very good then about trying to find a reasonable compromise. Obviously, few people got their preferred naming convention, but at least we had a whole committee to decide on the color of the bicycle shed. I'm not going to vote in a forum like this. There are online polls that you can do which would do a better job. Personally, I think it'd be best to do something like "please rate on a scale of 1 to 5 how much you like the following terms representing 'toe' in the current range design" (worst) (best) toe 1 2 3 4 5 tail 1 2 3 4 5 last 1 2 3 4 5 back 1 2 3 4 5 Something like that would allow doing things like computing the average score of all words.Few saw the obvious bugs in the documentation and examples :o).And here I thought is was better to point out bigger things like questionable API's ;)So please let's vote once and for all. I will note that I disagree we should ignore what conventions other languages have. Provincialism is the appurtenance of the incult. To that end, I looked around at how some languages define some primitives. LISP: car last http://www.gigamonkeys.com/book/they-called-it-lisp-for-a-reason-list-processing.html Scheme: car last http://merd.sourceforge.net/pixel/language-study/syntax-across-languages-per-language/Scheme.html ML: hd last http://www.standardml.org/Basis/list.html Ocaml: hd no last http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html Apparently Ocaml programmers tend to define their own function called "last": http://nodens.physics.ox.ac.uk/~mcdonnell/lab/code/code_ocaml/ocaml_fold/ocaml_fold.html http://caml.inria.fr/pub/ml-archives/caml-list/2004/04/06d65a793fa0503218c06783be2facbe.en.html Haskell: head last http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/head.html http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/last.html C++: front back http://support.microsoft.com/kb/158613What about my favorite from C++ iterators? *Scala: head last http://www.scala-lang.org/docu/files/api/scala/List.html Couldn't find after searching MS's asinine dox for 5 mins. Java: obj.get(0) obj.get(obj.size-1) http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractSequentialList.html Python: lst[0] lst[len(lst)-1] So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o). Andrei
Jan 28 2009
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message news:glqt38$14p2$1 digitalmars.com...It looks like there is endless debate on the naming convention for the range operations. Few saw the obvious bugs in the documentation and examples :o). So please let's vote once and for all. I will note that I disagree we should ignore what conventions other languages have. Provincialism is the appurtenance of the incult. To that end, I looked around at how some languages define some primitives. LISP: car last http://www.gigamonkeys.com/book/they-called-it-lisp-for-a-reason-list-processing.html Scheme: car last http://merd.sourceforge.net/pixel/language-study/syntax-across-languages-per-language/Scheme.html ML: hd last http://www.standardml.org/Basis/list.html Ocaml: hd no last http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html Apparently Ocaml programmers tend to define their own function called "last": http://nodens.physics.ox.ac.uk/~mcdonnell/lab/code/code_ocaml/ocaml_fold/ocaml_fold.html http://caml.inria.fr/pub/ml-archives/caml-list/2004/04/06d65a793fa0503218c06783be2facbe.en.html Haskell: head last http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/head.html http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/last.html C++: front back http://support.microsoft.com/kb/158613 Scala: head last http://www.scala-lang.org/docu/files/api/scala/List.html Couldn't find after searching MS's asinine dox for 5 mins. Java: obj.get(0) obj.get(obj.size-1) http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractSequentialList.html Python: lst[0] lst[len(lst)-1] So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o). AndreiFirst, Last simply make sense to me. Head would be nice to, but Toe just doesn't seems very straightforward.
Jan 28 2009
In order of preference... 1. head/toe 2. front/back 3. first/last 4. top/bottom Really, anything symmetrical would work... just not car/cdr!
Jan 28 2009
Andrei Alexandrescu wrote:So please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 28 2009
Simen Kjaeraas wrote:Andrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go. AndreiSo please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 28 2009
Hello Andrei,Simen Kjaeraas wrote:It can walk the plank on the starboard side. :) -JJR -JJRAndrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go. AndreiSo please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 28 2009
Andrei Alexandrescu wrote:Simen Kjaeraas wrote:Just to toss my 2cents into the hat, I'll introduce a new pair: leading/trailingAndrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go. AndreiSo please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 28 2009
On Thu, Jan 29, 2009 at 1:25 PM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Simen Kjaeraas wrote:Can't you just think of it as the first of the range, not the first of everything? If you ask me who is first in line, I'm going to tell you who is the first in line right now, currently. Not who was first back when the line first formed. This seems similar to me. So not confusing at all if you think of it that way. The range is not the container. --bbAndrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go.So please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 28 2009
Bill Baxter wrote:On Thu, Jan 29, 2009 at 1:25 PM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I could, if "next" weren't called "next". If the current is called "first", "next" means to move to another quantum universe in which the current "first" is forgotten and what was after "first" in the previous universe is now "first". That doesn't strike me as intuitive :o).Simen Kjaeraas wrote:Can't you just think of it as the first of the range, not the first of everything?Andrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go.So please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- SimenIf you ask me who is first in line, I'm going to tell you who is the first in line right now, currently. Not who was first back when the line first formed. This seems similar to me. So not confusing at all if you think of it that way. The range is not the container.That's a good point, but... we are at liberty to choose ANY names we please. Is this weird "first"/"next" combo our best shot? Andrei
Jan 28 2009
On Thu, Jan 29, 2009 at 1:51 PM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Bill Baxter wrote:But unless you've got some new words to add, we've listed pretty much every reasonable pair, and they all have issues of similar magnitude (or at least which some fraction of people will declare is of similar magnitude...) --bbOn Thu, Jan 29, 2009 at 1:25 PM, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:I could, if "next" weren't called "next". If the current is called "first", "next" means to move to another quantum universe in which the current "first" is forgotten and what was after "first" in the previous universe is now "first". That doesn't strike me as intuitive :o).Simen Kjaeraas wrote:Can't you just think of it as the first of the range, not the first of everything?Andrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go.So please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- SimenIf you ask me who is first in line, I'm going to tell you who is the first in line right now, currently. Not who was first back when the line first formed. This seems similar to me. So not confusing at all if you think of it that way. The range is not the container.That's a good point, but... we are at liberty to choose ANY names we please. Is this weird "first"/"next" combo our best shot?
Jan 28 2009
On 2009-01-29 00:02:20 -0500, Bill Baxter <wbaxter gmail.com> said:On Thu, Jan 29, 2009 at 1:51 PM, Andrei AlexandrescuI think "first/last" goes well with "advance/retreat". Note how "advance" is a natural word in this context... quoted from the "What's the deal with __buck?" thread, Andrei says: "Now consider I want to advance 10 steps in that range."... yet, he wants to name the function "next". Not only that, but the word "advance" is used everywhere Andrei's documentation for std.range, whenever it talks about "next"... some quotes: "isInputRange: r.next advances to the next element in the range." "struct Radial(R): void next(); Range primitive operation that advances the range to its next element. This one's funny: "Range drop(Range)(size_t n, Range r): Eagerly advances a copy of r n times (by calling r.next n times)" "struct SListRange(T,Topology topology = Topology.flexible): void next(); Range primitive operation that advances the range to its next element." "struct Zip(R...): void next(); Advances to the next element in all controlled ranges." Unfortunately there is no definition for "retreat" to compare with. -- Michel Fortin michel.fortin michelf.com http://michelf.com/That's a good point, but... we are at liberty to choose ANY names we please. Is this weird "first"/"next" combo our best shot?But unless you've got some new words to add, we've listed pretty much every reasonable pair, and they all have issues of similar magnitude (or at least which some fraction of people will declare is of similar magnitude...)
Jan 29 2009
Michel Fortin wrote:On 2009-01-29 00:02:20 -0500, Bill Baxter <wbaxter gmail.com> said:Hehe, this argument works in my favor. Advancing means making a number of steps. Next means taking one step. AndreiOn Thu, Jan 29, 2009 at 1:51 PM, Andrei AlexandrescuI think "first/last" goes well with "advance/retreat". Note how "advance" is a natural word in this context... quoted from the "What's the deal with __buck?" thread, Andrei says: "Now consider I want to advance 10 steps in that range."... yet, he wants to name the function "next".That's a good point, but... we are at liberty to choose ANY names we please. Is this weird "first"/"next" combo our best shot?But unless you've got some new words to add, we've listed pretty much every reasonable pair, and they all have issues of similar magnitude (or at least which some fraction of people will declare is of similar magnitude...)
Jan 29 2009
Andrei Alexandrescu wrote:That's a good point, but... we are at liberty to choose ANY names we=20 please. Is this weird "first"/"next" combo our best shot?Has =93current=94 been suggested? How many terms are needed? Of the ordinals {first, previous, current,=20 next, last}, however they are named, are any not needed? Are any more=20 needed? randomth? nth? =97Joel Salomon
Jan 29 2009
Joel C. Salomon wrote:Andrei Alexandrescu wrote:Current and curr have been suggested. I was only looking at two terms for now, i.e. the front and back position in the range. "next" and "empty" remained less controversial and I was happy to reduce the scope of the vote. AndreiThat's a good point, but... we are at liberty to choose ANY names we please. Is this weird "first"/"next" combo our best shot?Has “current” been suggested? How many terms are needed? Of the ordinals {first, previous, current, next, last}, however they are named, are any not needed? Are any more needed? randomth? nth? —Joel Salomon
Jan 29 2009
Andrei Alexandrescu escribió:Simen Kjaeraas wrote:Shouldn't the user think the same with "head" or "front"? I think the problem is "next" in this case: it should be "moveToNext" or something that shows that you are changing the input, not just requesting the next element in the range. But keep "next". Once the user starts using ranges, he'll understand the terminology, which is pretty straightforward. I vote for first/last.Andrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go.So please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 28 2009
Andrei Alexandrescu wrote:Simen Kjaeraas wrote:I like the following from Chad's list: begin/end current/last current/back first/last front/back left/right head/last head/back start/end start/last my preffered choice would be first/last. regarding the above point: _all_ ranges have a "head" but "tow" is optional, so maybe the desire for symetry is less important. how about current/last? while (!_input.empty && !pred(_input.current)) _input.next; also, I'd prefer to have a positive test instead of a negative one: while (_input.more && !pred(_input.current)) _input.next; but I could live with the current "empty".Andrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go. AndreiSo please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 28 2009
On Thu, 29 Jan 2009 06:25:58 +0200, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Simen Kjaeraas wrote:I don't think that "next" is an appropriate name here. Since it is an action, it should be named as one - "next" sounds more like a function (which doesn't modify the instance). Have you considered "forward"? -- Best regards, Vladimir mailto:thecybershadow gmail.comAndrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go.So please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 29 2009
Hello Andrei,It looks like there is endless debate on the naming convention for the range operations. Few saw the obvious bugs in the documentation and examples :o). So please let's vote once and for all. I will note that I disagree we should ignore what conventions other languages have. Provincialism is the appurtenance of the incult. To that end, I looked around at how some languages define some primitives. LISP: car last http://www.gigamonkeys.com/book/they-called-it-lisp-for-a-reason-list- processing.html Scheme: car last http://merd.sourceforge.net/pixel/language-study/syntax-across-languag es-per-language/Scheme.html ML: hd last http://www.standardml.org/Basis/list.html Ocaml: hd no last http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html Apparently Ocaml programmers tend to define their own function called "last": http://nodens.physics.ox.ac.uk/~mcdonnell/lab/code/code_ocaml/ocaml_fo ld/ocaml_fold.html http://caml.inria.fr/pub/ml-archives/caml-list/2004/04/06d65a793fa0503 218c06783be2facbe.en.html Haskell: head last http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/head.h tml http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/last.h tml C++: front back http://support.microsoft.com/kb/158613 Scala: head last http://www.scala-lang.org/docu/files/api/scala/List.html Couldn't find after searching MS's asinine dox for 5 mins. Java: obj.get(0) obj.get(obj.size-1) http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractSequentialLi st.html Python: lst[0] lst[len(lst)-1] So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o). Andreihead/last. I consider it symmetrical in the context of use, because in this case head implies "first", not a part of our anatomy. Another option: head/stern... but, arguably, this is not perfectly symmetrical. Otherwise, I just go with whatever gets put in there, I guess. :) -JJR
Jan 28 2009
head/last It seems fairly popular and doesn't cause any confusion with 'tail' if we decide to use that later on. Sean
Jan 28 2009
Sean Kelly wrote:head/last It seems fairly popular and doesn't cause any confusion with 'tail' if we decide to use that later on. SeanThis. +1
Jan 29 2009
I'd be ok with any of these: head/last head/tail front/back current/last curr/last car_bonnet/car_boot (just kidding ;)) But beyond that, I'd sooner choose "head/foot" over "head/toe". If array-style indexing were ever done, I'd be against using negative values to indicate distance from end. The semantics of a paramater should never be dependant on the paramater's value. (I think that classic book "Writing Solid Code" called that a "candy-machine interface", IIRC? Or maybe that as something different.)
Jan 28 2009
Hello Andrei,C++: front back http://support.microsoft.com/kb/158613Wow I actuly like something C++ did. vote++
Jan 28 2009
On Thu, Jan 29, 2009 at 3:17 PM, BCS <none anon.com> wrote:Hello Andrei,I could go for front/back too. head/toe or first/last are also ok by me. --bbC++: front back http://support.microsoft.com/kb/158613Wow I actuly like something C++ did. vote++
Jan 28 2009
I don't agree that "first must go". I vote: first/last
Jan 28 2009
Ideally, I'd like to change all the names for the interface to be: front -- first element in the range back -- last element in the range advanceFront -- advance the front element by one retreatBack -- retreat the back element by one And, tempting fate... nonEmpty -- as Walter one espoused: negative = bad, positive = good :D If I can't have my cake and eat it too, then front/back will suffice. -- Daniel
Jan 28 2009
Daniel Keep wrote:And, tempting fate... nonEmpty -- as Walter one espoused: negative = bad, positive = good :D*ONCE*... as Walter ONCE espoused...
Jan 28 2009
On Thu, Jan 29, 2009 at 4:11 PM, Daniel Keep <daniel.keep.lists gmail.com> wrote:nonEmpty -- as Walter one espoused: negative = bad, positive = good :DI think that's exactly the kind of thing he meant to avoid. Now you have if (!nonEmpty) { /* don't not do nothing here */ } Hopefully you were just joking... --bb
Jan 28 2009
Bill Baxter wrote:On Thu, Jan 29, 2009 at 4:11 PM, Daniel Keep <daniel.keep.lists gmail.com> wrote:Thing is that most of the time, I'm more interested in testing to see if a container/sequence has something in it rather than has nothing in it. while( range.nonEmpty ) { doSomethingWith(range.front); range.advanceFront; } I admit that nonEmpty is probably a bad name; I just couldn't think of a short and pithy way of saying 'has something in it.' Then again, I don't want to start another war of semantics; it's not the end of the world :P -- DanielnonEmpty -- as Walter one espoused: negative = bad, positive = good :DI think that's exactly the kind of thing he meant to avoid. Now you have if (!nonEmpty) { /* don't not do nothing here */ } Hopefully you were just joking... --bb
Jan 29 2009
On Thu, Jan 29, 2009 at 5:33 PM, Daniel Keep <daniel.keep.lists gmail.com> wrote:Bill Baxter wrote::-) Ok. .more, .hasMore, .remains, .hasFront, something of that ilk would do it then. --bbOn Thu, Jan 29, 2009 at 4:11 PM, Daniel Keep <daniel.keep.lists gmail.com> wrote:Thing is that most of the time, I'm more interested in testing to see if a container/sequence has something in it rather than has nothing in it. while( range.nonEmpty ) { doSomethingWith(range.front); range.advanceFront; } I admit that nonEmpty is probably a bad name; I just couldn't think of a short and pithy way of saying 'has something in it.' Then again, I don't want to start another war of semantics; it's not the end of the world :PnonEmpty -- as Walter one espoused: negative = bad, positive = good :DI think that's exactly the kind of thing he meant to avoid. Now you have if (!nonEmpty) { /* don't not do nothing here */ } Hopefully you were just joking... --bb
Jan 29 2009
On 2009-01-29 03:33:13 -0500, Daniel Keep <daniel.keep.lists gmail.com> said:while( range.nonEmpty ) { doSomethingWith(range.front); range.advanceFront; }What I'd like is to place directly the range in the conditional expression and have it converted to a boolean (false if empty, true if not): while (range) { doSomethingWith(range.front); range.advanceFront; } -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Jan 29 2009
"Daniel Keep" wroteIdeally, I'd like to change all the names for the interface to be: front -- first element in the range back -- last element in the range advanceFront -- advance the front element by one retreatBack -- retreat the back element by one And, tempting fate... nonEmpty -- as Walter one espoused: negative = bad, positive = good :DThat has a negative term right in it "non". Why do people consider empty to be negative? It's actually zero :P -Steve
Jan 29 2009
Steven Schveighoffer wrote:"Daniel Keep" wroteWell, if someone were to call you "empty-headed" in an outrageous French accent, you wouldn't be too happy about that, would you? :D The only positive form of "empty" I can think of is "empty pit of snakes," much preferable to any alternatives. As it stands, I really wish I'd taken the time to think of a better phrase than "nonEmpty." -- DanielIdeally, I'd like to change all the names for the interface to be: front -- first element in the range back -- last element in the range advanceFront -- advance the front element by one retreatBack -- retreat the back element by one And, tempting fate... nonEmpty -- as Walter one espoused: negative = bad, positive = good :DThat has a negative term right in it "non". Why do people consider empty to be negative? It's actually zero :P -Steve
Jan 29 2009
"Daniel Keep" wroteSteven Schveighoffer wrote:I'd probably wait until they taunt me a second time, then sneek into their house inside a large wooden rabbit (which unbeknownst to them would be nonEmpty!)"Daniel Keep" wroteWell, if someone were to call you "empty-headed" in an outrageous French accent, you wouldn't be too happy about that, would you? :DIdeally, I'd like to change all the names for the interface to be: front -- first element in the range back -- last element in the range advanceFront -- advance the front element by one retreatBack -- retreat the back element by one And, tempting fate... nonEmpty -- as Walter one espoused: negative = bad, positive = good :DThat has a negative term right in it "non". Why do people consider empty to be negative? It's actually zero :P -SteveThe only positive form of "empty" I can think of is "empty pit of snakes," much preferable to any alternatives.Empty bathroom stall Empty trash Empty parking space There's all kinds of "good" empties :) Of course, I think when one thinks of avoiding negatives in programming, it's not to make us all feel more positive joy about our code, I think it's to avoid using terms that are negators like notDone, or nonEmpty. The reason being that it looks and reads weird when you see !notDone. Whereas, if it's just done, then you can have done or !done, and both read fine. As for empty, you could use "done" or "hasNext" or whatever, but as far as I'm concerned, these are nitpicks. empty and !empty describe the situation perfectly and read fine. -Steve
Jan 29 2009
Daniel Keep wrote:advanceFront -- advance the front element by one retreatBack -- retreat the back element by oneI like this. Verb instead of noun for action, unambiguous about which end moves in which direction, and it's symmetrical.nonEmpty -- as Walter one espoused: negative = bad, positive = good :DI don't like this. "!empty" reads better than "nonEmpty", and "empty" reads much better than "!nonEmpty". -- Rainer Deyke - rainerd eldwood.com
Jan 29 2009
I'd like to vote for 1. head/tail The pair is symmetric in its meaning, has the same length (4 letters) which sometimes gives better look for source codes, has similarity with the Unix head(1) and tail(1) command, and also has in common with, say, J Programming Language (http://www.jsoftware.com/help/dictionary/vocabul.htm). I know that several languages already use 'tail' to mean 'except the head', but I don't think that makes big confusion... If I choose from the list you posted, I like 2. Haskell/Scala: head/last
Jan 28 2009
On Wed, 28 Jan 2009 16:26:17 -0800, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:It looks like there is endless debate on the naming convention for the range operations. Few saw the obvious bugs in the documentation and examples :o). So please let's vote once and for all. I will note that I disagree we should ignore what conventions other languages have. Provincialism is the appurtenance of the incult. To that end, I looked around at how some languages define some primitives. LISP: car last http://www.gigamonkeys.com/book/they-called-it-lisp-for-a-reason-list-processing.html Scheme: car last http://merd.sourceforge.net/pixel/language-study/syntax-across-languages-per-language/Scheme.html ML: hd last http://www.standardml.org/Basis/list.html Ocaml: hd no last http://caml.inria.fr/pub/docs/manual-ocaml/libref/List.html Apparently Ocaml programmers tend to define their own function called "last": http://nodens.physics.ox.ac.uk/~mcdonnell/lab/code/code_ocaml/ocaml_fold/ocaml_fold.html http://caml.inria.fr/pub/ml-archives/caml-list/2004/04/06d65a793fa0503218c06783be2facbe.en.html Haskell: head last http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/head.html http://www.cs.chalmers.se/Cs/Grundutb/Kurser/d1pt/d1pta/ListDoc/last.html C++: front back http://support.microsoft.com/kb/158613 Scala: head last http://www.scala-lang.org/docu/files/api/scala/List.html Couldn't find after searching MS's asinine dox for 5 mins. Java: obj.get(0) obj.get(obj.size-1) http://java.sun.com/j2se/1.4.2/docs/api/java/util/AbstractSequentialList.html Python: lst[0] lst[len(lst)-1] So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o). Andreihead/toe (I'm not a native speaker, so this sounds perfectly good to me) head/last (there is not much symmetry in the real world) front/back face/nape
Jan 28 2009
Andrei Alexandrescu:Python: lst[0] lst[len(lst)-1]I have not read the whole thread so someone else may have already answered, but that's not pythonic, the last item is represented as:'e'lst = "abcde" lst[-1]'d' etc. You can write those in D as: lst[$-1] lst[$-2] Bye, bearophilelst[-2]
Jan 28 2009
On Wed, 28 Jan 2009 16:26:17 -0800, Andrei Alexandrescu wrote:So please let's vote once and for all.Before doing so, can I ask for a clarification, naming what *exactly* are we voting for? I know we are talking about the /names/ of things but what are the things we are naming here? (I assume we are only talking ranges here BTW) Do they include ... (A) The first element (B) The last element (C) The leftmost set of elements that excludes the last element? (D) The rightmost set of elements that excludes the first element? (E) The set of elements that excludes both the first and last element. (F) The /current/ element (assuming some sort of 'cursor' concept). (G) The action of adjusting a range so that next (A) returns the element that immediately follows the current (A) element. (H) The action of adjusting a range so that next (B) returns the element that immediately precedes the current (B) element. My preferences are ... (A) first (B) last (C) firstpart (D) lastpart (E) midpart (F) current (G) dropfirst (H) droplast -- Derek Parnell Melbourne, Australia skype: derek.j.parnell
Jan 29 2009
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> kirjoitti viestissä news:glqt38$14p2$1 digitalmars.com...So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o).I'll vote for curr(ent)-last
Jan 29 2009
Andrei Alexandrescu wrote:It looks like there is endless debate on the naming convention for the range operations.head/toe > front/back >> all the other suggestions >> car. FWIW, I'd say start and end is the only pairing which is natural for English speakers. Once you reject them, I think you've committed to a pairing which is going to sound peculiar part of the time. English idiom is interesting -- we talk about the "head of the queue" but never the "tail of the queue", rather the "end of the queue". "start/end of the queue", "start/end of the list", "start/end of the range" (though "beginning" is more natural than start). "head/end of the queue", "head/end of the list" "front/back of the queue" (doesn't work for lists. Only solid objects have a front and a back).
Jan 29 2009
Don wrote:FWIW, I'd say start and end is the only pairing which is natural for English speakers.I disagree. Start and end can be both nouns or verbs. First and last are less ambiguous in this context.
Jan 29 2009
Brian Hay wrote:Don wrote:Yes. You can also "front up to something" and "back into somebody" <g>. BTW I'm not saying that start/end is the best choice. I'm just saying that if you decision is based only on what sounds natural, you don't have very many choices at all. In particular, _none_ of the spatial pairings work. First and last areFWIW, I'd say start and end is the only pairing which is natural for English speakers.I disagree. Start and end can be both nouns or verbs.less ambiguous in this context.True. I missed them. "First in the queue"/"Last in the queue".
Jan 29 2009
front/back is my preferred, but first/last, head/tail are ok. Gide
Jan 29 2009
I don't mind much about the names for head and toe. Anything that makes some sense of being the two ends of the range when you read it is fine by me. What I don't like is "next": should be "advance". -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Jan 29 2009
Andrei Alexandrescu Wrote:It looks like there is endless debate on the naming convention for the range operations. Few saw the obvious bugs in the documentation and examples :o). So please let's vote once and for all. I will note that I disagree we should ignore what conventions other languages have. Provincialism is the appurtenance of the incult. To that end, I looked around at how some languages define some primitives. [snip] So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o). AndreiI don't like first/last. Given a sequence, its first and last elements are fixed (even if the sequence advances), i.e. first, head, toe and last have strict ordering to me. Head/Toe is acceptable, but I don't like it either. Head has a well-known and unambiguous meaning, which is ok. But toe... (Being a non-native english speaker) I didn't even know its meaning until I looked it up in a dictionary. It sounds more like a head/bar pair to me (i.e. completely unrelated). "Collection's toe element" doesn't tell anything and it takes some time to recall term's meaning in this context (I got used to it a bit, though). Other property I don't like about 'toe' is that it is shorter than its counterpart - 'head' - I think it should be the same or slightly longer. That said, best names for me are left(most) and right(most), but they are not listed here :( May I vote for them?
Jan 29 2009
Sean Kelly Wrote:head/last It seems fairly popular and doesn't cause any confusion with 'tail' if we decide to use that later on. SeanI don't think head/tail gives any confusion (it certainly doesn't to me). I believe 'tail' (meaning 'everything but head') is misused in other languages, the correct term for it is 'rest'. head/tail - first and last elements head/rest - first element and the rest. Is there any ambiguity?
Jan 29 2009
So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o). Andreifront/back head/rhead head/toe jekyll/hyde
Jan 29 2009
Brian wrote:pinky/theBrain <joking>So please let's vote once and for all. No choice will please everybody, but I want to settle for something that at least won't displease the most vehement ones :o). Andreifront/back head/rhead head/toe jekyll/hyde
Jan 29 2009
Vladimir Panteleev Wrote:On Thu, 29 Jan 2009 06:25:58 +0200, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Agree, "advance" would be a better name, though (imo).Simen Kjaeraas wrote:I don't think that "next" is an appropriate name here. Since it is an action, it should be named as one - "next" sounds more like a function (which doesn't modify the instance). Have you considered "forward"? -- Best regards, Vladimir mailto:thecybershadow gmail.comAndrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go.So please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 29 2009
Denis Koroskin wrote:Vladimir Panteleev Wrote:Same, it seems BETTER. Though, it seems like it's suboptimal as well. As I understand it we aren't so much moving rightward a head that's reading a tape, but instead we are incrementally chopping off the leftmost elements until none are left. So it is possible (though not intuitive) to draw analogies and write metaphors: we are advancing our knife each time we chop off a bit of carrot. Anyways, while technically incorrect as far as I can tell, it isn't aesthetically displeasing to me, so in some odd way I am alright with next. Hmmm... maybe "chop" is a good word for this... - ChadOn Thu, 29 Jan 2009 06:25:58 +0200, Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> wrote:Agree, "advance" would be a better name, though (imo).Simen Kjaeraas wrote:I don't think that "next" is an appropriate name here. Since it is an action, it should be named as one - "next" sounds more like a function (which doesn't modify the instance). Have you considered "forward"? -- Best regards, Vladimir mailto:thecybershadow gmail.comAndrei Alexandrescu wrote:Ok, after looking at my code I discovered a huge problem with "first". ("Last" is cool.) If all you do is implement them and use them with foreach, fine. But if you need to call them manually (which is the case sometimes), you get really badly interacting terms there. Look at this, taken from real code (the filter function): while (!_input.empty && !pred(_input.first)) _input.next; I can see the putative user scratching their head: "Ok, so I start iteration with the first element, then I move to the next one... but then why the heck am I looking at the first again?" "First" must go.So please let's vote once and for all. AndreiDo let's. My first vote goes to first/last, with head/toe at second place. -- Simen
Jan 29 2009
Chad J wrote:Denis Koroskin wrote:That's why I suggested "advanceFront" and "retreatBack." I don't think there's a single, short word to exactly express the concept "move the front of a view of some sequence one element towards the end." -- DanielAgree, "advance" would be a better name, though (imo).Same, it seems BETTER. Though, it seems like it's suboptimal as well. As I understand it we aren't so much moving rightward a head that's reading a tape, but instead we are incrementally chopping off the leftmost elements until none are left. So it is possible (though not intuitive) to draw analogies and write metaphors: we are advancing our knife each time we chop off a bit of carrot. Anyways, while technically incorrect as far as I can tell, it isn't aesthetically displeasing to me, so in some odd way I am alright with next. Hmmm... maybe "chop" is a good word for this... - Chad
Jan 29 2009
Chad J wrote:As I understand it we aren't so much moving rightward a head that's reading a tape, but instead we are incrementally chopping off the leftmost elements until none are left. So it is possible (though not intuitive) to draw analogies and write metaphors: we are advancing our=knife each time we chop off a bit of carrot.<snip>Hmmm... maybe "chop" is a good word for this...How about =93chomp=94 and =93regurgitate=94? ;)
Jan 30 2009
Andrei Alexandrescu wrote:So please let's vote once and for all.1st pick: first/last 2nd pick: front/back -- Rainer Deyke - rainerd eldwood.com
Jan 29 2009
Andrei Alexandrescu wrote:So please let's vote once and for all.first/last. They're just the most sensible symbols to use for retrieving the first and last element :).LISP: car last http://www.gigamonkeys.com/book/they-called-it-lisp-for-a-reason- ist-processing.htmlCommon Lisp (the Lisp I'm most familiar with) also has 'first', which is equivalent to 'car' and the antonym of 'last'. ('car's antonym is 'cdr', 'car' and 'last' are not meant to be paired up like this)
Jan 30 2009