What does iota of std::iota stand for?

I'm assuming the "i" is increment and the "a" is assign, but I could not figure out or find the answer. Also, it looks very similar to the non-standard itoa which I think is confusing.


Solution 1:

iota doesn't stand for anything—it is not an acronym or an initialism. It is the name of the ninth letter of the Greek alphabet.

From the original SGI STL documentation:

The name iota is taken from the programming language APL.

Ken Iverson created APL (“A Programming Language”). He discussed APL in his 1979 Turing Award lecture, “Notation as a Tool of Thought”, including this description of APL's iota function:

For example, the integer function denoted by ι produces a vector of the first n integers when applied to the argument n, …

That ι is the lower-case Greek letter iota.

In the quote above, I typed ι, U+03B9, “GREEK SMALL LETTER IOTA”, but Unicode actually has a dedicated code point for APL's iota: is U+2373, “APL FUNCTIONAL SYMBOL IOTA”.


In response to the demands of commenters, I shall further address the etymology of “iota” in this context.

The likeliest answer is that Dr. Iverson wanted a symbol which would remind the user of the word “integer” and the use of the letter “i” as a typical integer variable, especially for array subscripting. Sadly, Dr. Iverson died in 2004, several years before this question was even asked, so we cannot ask him for an explanation.

But let's suppose there is a deeper meaning.

According to the Oxford English Dictionary, “iota” is “The name of the Greek letter Ι, ι, corresponding to the Roman I, i; the smallest letter of the Greek alphabet” (smallest physically, not alphabetically, I presume), and also means “The least, or a very small, particle or quantity”. The OED's earliest known usage of this meaning is from Clavis mystica by Daniel Featley in 1636:

Shall we lose, or sleightly pass by, any iota or tittle of the Booke of God?

Clavis mystica describes itself as “a key opening divers difficult and mysterious texts of Holy Scripture”, and this sentence is in particular referring to Matthew 5:18. The 1611 edition of the King James Version has this text for Matthew 5:18:

matthew 5:18

Transcription:

For verily I say vnto you, Till heauen and earth passe, one iote or one title, shall in no wise passe from the law, till all be fulfilled.

The OED gives “iote” as another form of “jot”, which (like “iota”) descends from the Greek word “ἰῶτα”, which is the Greek name for the letter in question. Why did Featley change “iote” to “iota”? Sadly, I don't have a copy of Clavis mystica in my personal library, so I can't investigate that further.

In the original Greek of Matthew 5:18, “iote” is “ἰῶτα”, and “title” (or more modernly, “tittle”) is “κεραία”. The word “κεραία” meant, roughly, “serif” or “apostrophe”. So this Bible verse is referring to the idea of the smallest details, and using “ἰῶτα” to refer to the letter iota in its role as the physically smallest letter of the Greek alphabet.

Thus we may deduce that the STL function iota, and its APL antecedent , are named, by way of the Bible, after the physically smallest letter of the Greek alphabet “ι”, because these functions produce integers separated by the smallest amount by which integers may be separated.

According to Wikipedia, The Greek letter iota came from the Phoenician letter yōdh.

This is as far afield of programming as I currently wish to go for this question.

Solution 2:

Its the greek letter that sometimes gets used in mathematics to denote sets of numbers or unit vectors. In the C++ case, you get a constructed vector set. Nothing to do with itoa.

Solution 3:

std::iota will fill an iterator range with successively incremented values.

To answer your specific question, it actually doesn't stand for anything. Iota (pronounced "eye-oh-duh" or "eye-oh-tuh" in English) is a greek letter with mathematical connotations.

It is standard in C++11, but not in earlier standards.

Solution 4:

Oh, I was always under the impression that since std::iota(start,end,0) essentially stands for

for(size_t i = 0; i < std::distance(start, end) ; i++) { start[i] = i; }

then you essentially "assign i" to each array element, and iota is greek for i, so there.

(I wouldn't be surprised if that was the rationale for the APL choice, mentioned in @robmayoff's answer, although I have no idea whether that's the case.)