Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indices or indexes? #12902

Closed
eschnett opened this issue Sep 1, 2015 · 39 comments
Closed

indices or indexes? #12902

eschnett opened this issue Sep 1, 2015 · 39 comments
Assignees
Milestone

Comments

@eschnett
Copy link
Contributor

eschnett commented Sep 1, 2015

Should Julia choose either of the terms indices or indexes as preferred when talking about arrays? From a usability point of view, it is probably desirable to choose one of the terms and stick with it, especially when it comes to name publicly visible functions in the base language or commonly used packages.

Currently, looking for either term finds about the same number of occurrences (in both local variables, argument names, and documentation combined). Some other languages (e.g. Fortran, Python) prefer indices, database systems seem to prefer indexes. Google tells me that common language prefers "indexes" while math and computer science prefer "indices".

@eschnett eschnett added the needs decision A decision on this change is needed label Sep 1, 2015
@mbauman
Copy link
Sponsor Member

mbauman commented Sep 1, 2015

I'm terribly guilty of using both semi-interchangeably. I think I have some sort of rule in my head, where indices are abstract and indexes are a concrete collection with more than one index, but it drives me batty looking back and seeing a mix. +1 to standardizing on just one or the other.

$ ack indexes base | wc -l
      99
$ ack indices base | wc -l
      75

@jiahao
Copy link
Member

jiahao commented Sep 1, 2015

We should stick with "indexes".

  1. The Base API consistently uses "indexes", even if the internal variables, comments and docs don't always. Consider the functions localindexes and parentindexes for example.
  2. Jeff's thesis uses "indexes" consistently as his personal preference.
  3. "Indexes" is the more popular usage. Example: Google n-gram.
  4. The major US and UK dictionaries I've consulted all list both as equivalent spellings. Note though that the OED entry states:

In current use the plural is indices in senses 8, 9, and usually in other senses except 5, in which indexes is usual.

Senses 8 and 9 refer to usage in mathematics and the sciences; 5 is the bibliographic sense (book indexes).

@tkelman
Copy link
Contributor

tkelman commented Sep 1, 2015

+1 for indices

@mbauman
Copy link
Sponsor Member

mbauman commented Sep 1, 2015

I'm surprised it's weighted so heavily towards indices in registered packages:

$ ack indexes --type=julia ALL_PACKAGES | wc -l
     324
$ ack indices --type=julia ALL_PACKAGES | wc -l
    1339

I'd favor indexes. I think I tend to use indices only in prose.

@ScottPJones
Copy link
Contributor

Given that indices is more the norm for math/sciences/technical meaning, and that crowd has a very high representation among Julians, I'm not surprised by that result in the registered packages (also due to the very international following that Julia has, I suppose).

@ScottPJones
Copy link
Contributor

Also, some people make a distinction between database indexes, and array indices. Kind of crazy, but it happens.

@Jakki42
Copy link

Jakki42 commented Sep 1, 2015

Being a non-English speaker by nature indexes is significantly easier for me to notice without a single though that it's about indexing, than indices which requires slight amount of brain work to realize what it's about.

@JeffBezanson
Copy link
Sponsor Member

Down with irregular plurals!

@ScottPJones
Copy link
Contributor

Flip a coin, and decide. I'll be happy to help change things either direction.

@hainm
Copy link

hainm commented Sep 1, 2015

+1 for indices. It is a bit easier to pronounce.

@joa-quim
Copy link

joa-quim commented Sep 2, 2015

In Portuguese ans Spanish (I think) it's indices, so that one is naturally easier for us.

@eschnett
Copy link
Contributor Author

eschnett commented Sep 2, 2015

+1 for array indices as well. Fortran, Matlab, Python, R all seem to use "indices".

Note that simple searches do not give clear results, as "indexes" has a second meaning that shouldn't be counted: "the variable i indexes into the array", i.e. third person singular of the verb "to index".

@J-Sarnoff
Copy link

In matters Julia, I am greatly reluctant to advocate other than @JeffBezanson's sense of appropriateness.

with great reluctance

(This plural of index quandry is something I have examined deeply, so fwiw)
When I have more than one index, say an index of people and an index of topics then I have two indexes; when I have more than one item gathered in a well-ordered, addressable collective then I have some indices.

@kmsquire
Copy link
Member

kmsquire commented Sep 2, 2015

@J-Sarnoff's definition makes the most sense to me.

@kmsquire
Copy link
Member

kmsquire commented Sep 2, 2015

(Definitions)

@KristofferC
Copy link
Sponsor Member

In Sweden we have it nice. Singular and plural of index is the same, it's just "index".

+0.1 for indices, (0.1 since I believe my Swedish vote is of little importance).

@mauro3
Copy link
Contributor

mauro3 commented Sep 2, 2015

+1 for indices

1 similar comment
@mlubin
Copy link
Member

mlubin commented Sep 2, 2015

+1 for indices

@dmbates
Copy link
Member

dmbates commented Sep 2, 2015

+1 for indices (I always cringe when I see "indexes")

@JeffBezanson
Copy link
Sponsor Member

Make no mistake, my preference for "indexes" is pure linguistic activism; I don't claim it's more correct according to current standards, but that it should be.

@mbauman
Copy link
Sponsor Member

mbauman commented Sep 2, 2015

We can skirt the issue in some cases, particularly for local variables — ind/inds or idx/idxs work nicely and are both commonly used. But unfortunately they don't make for nice conjugate word APIs: the abbreviations make it harder for me to read localinds and parentidxs without adding an underscore.

@ScottPJones
Copy link
Contributor

I imagine that the slight preference for "indexes" in Base (98 to 75 by my count) is due to the influence of a certain linguistic activist (and gets multiplied because most occurrences are due to functions having indexes in the name, which is then repeated multiple times in documentation), and the much larger preference of "indices" over "indexes" among registered packages is due both to the math/scientific/technical background of most Julians, and large number of people outside the US/Canada .

@eschnett
Copy link
Contributor Author

eschnett commented Sep 2, 2015

It seems there is a majority for indices.

This leads to the next question: Should the functions in Base that have currently indexes in their name receive counterparts with indices? And should the indexes versions be deprecated?

@simleb
Copy link

simleb commented Sep 4, 2015

+1 for indices

@ScottPJones
Copy link
Contributor

Any decision yet? Once a decision is made, at least all the error messages and documentation can be updated in a PR (changes to function names will need separate PRs and deprecations, IMO).

@AntonioSuriano
Copy link

indices

Case Singular Plural
nominative index indicēs
genitive indicis indicum
dative indicī indicibus
accusative indicem indicēs
ablative indice indicibus
vocative index indicēs

@alexranaldi
Copy link

+1 for indices

@JeffreySarnoff
Copy link
Contributor

My matrices have indices. Do your matrixes have indexes?

@jiahao
Copy link
Member

jiahao commented Feb 19, 2016

Two not irrelevant historical facts from my recent research:

  • From the 1850s until the 1980s, matrices were universally described in linear algebra textbooks as having subscripts, not indexes/indices. Books dating from the late 80s onward begin to use "indexes/indices" as synonymous with "subscripts".
  • The earliest descriptions of array data structures (early 1940s - ~1962) described them as "subscripted variables".

Now that DistributedArrays have been extricated from Base, the only remaining function clinging on to the regular plural is parentindexes.

@jiahao
Copy link
Member

jiahao commented Feb 19, 2016

Oh, and now there is a method with a keyword argument using indices:

Base.SparseArrays.sortSparseMatrixCSC!(A, sortindices = :sortcols)

so whatever we decide on is guaranteed to break some API.

@StefanKarpinski
Copy link
Sponsor Member

In my mind, "indices" is what a matrix or vector has, while a "indexes" is what a database table has if there's more than one index. Perhaps this is a made up distinction.

@JeffreySarnoff
Copy link
Contributor

@StefanKarpinski It is "a distinction with a difference."

@timholy
Copy link
Sponsor Member

timholy commented May 8, 2016

This issue now appears to be blocking 😄 for #16260.

@kmsquire
Copy link
Member

kmsquire commented May 8, 2016

In my mind, "indices" is what a matrix or vector has, while a "indexes" is what a database table has if there's more than one index. Perhaps this is a made up distinction.

👍 to this interpretation

@timholy
Copy link
Sponsor Member

timholy commented May 9, 2016

There seems to be more consensus behind indices, so I went with that in #16260.

@mbauman
Copy link
Sponsor Member

mbauman commented May 9, 2016

Interestingly, we're talking about indices and indexes in base quite a bit more than we were when this issue was opened… but we added them in almost exactly equal number:

134 indexes (up 35 from 99)
109 indices (up 34 from 75)

In #16251 I get rid of a whole slew of indexes, just barely bringing indices into the lead (97 - 102). The remaining major uses of indexes are: parentindexes, localindexes, to_indexes, and SubArray's indexes field. The most annoying cases are those like to_indexes, where there's also a singular name in the code base that it refers to.

@StefanKarpinski StefanKarpinski added this to the 0.6.0 milestone Sep 13, 2016
@tkelman tkelman added the help wanted Indicates that a maintainer wants help on an issue or pull request label Dec 29, 2016
@tkelman tkelman modified the milestones: 1.0, 0.6.0 Dec 29, 2016
@ararslan ararslan self-assigned this Jul 27, 2017
@ararslan ararslan removed the help wanted Indicates that a maintainer wants help on an issue or pull request label Aug 23, 2017
@mbauman
Copy link
Sponsor Member

mbauman commented Aug 24, 2017

It's rather remarkable how much more we're talking about indices a little over a year later:

$ ack indexes base | wc -l
      82
$ ack indices base | wc -l
     607

I think the only things left to do are update a few docstrings and deprecate (and maybe rename) parentindexes and localindexes. I'd be inclined to leave subarray's indexes field as it is; it's internal.

@JeffreySarnoff
Copy link
Contributor

What advantage obtains by getting this consistent vocabulary almost consistent within Julia?
An internal field name that has yet to be brought into the fold should be at task front:
for work as important as is Julia, the inside is as guardian of best practice for the outside.

@StefanKarpinski
Copy link
Sponsor Member

Let's go ahead and change all of them, including the field name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests