Please vote once and for good: range operations

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Jan 28 16:26:17 PST 2009


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

C#:
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



More information about the Digitalmars-d mailing list