A couple of days ago I posted “Modern” C++ Ruminations and I’ve gotten a lot of flack for this comment:
Not knowing the history of
iota()should not be something to be proud of, but an embarrassment.
By embarrassed I meant as when you are in a foreign country and you can’t remember the native words for please or thank you. Not as when you forget to wear pants on the first day of middle school. Also, not as when your doctor is telling you your diagnosis and you have no clue what he is saying. Unless you are a medical professional there is no reason for embarrassment. The way to fix such an embarrassment is to ask, then you can take pride in your new knowledge.
I gave a lecture recently and a student stopped me. “I’m sorry, I don’t know what a coroutine is. Can you explain?” More than happy to. That level of embarrassment.
If you have a better word, please provide it. But I believe embarrassment is the correct emotion to feel in response to one’s own ignorance.
To put this in context. This was a response to a snarky remark from Aras criticizing the iota name choice:
what’s an iota? it’s a Greek letter, look how smart I am!
I took this (as did Eric Neibler) as an attack on Eric and it was one of several comments of the same ilk. Aras clarified he intended this to be directed at the standard committee, not personally at Eric.
Here is the full history of the
iota name choice:
STL was greatly influenced by Ken Iverson’s work on APL. In Ken’s Turing award lecture from 1979 you will find this phrase:
For example, the integer function denoted by ι produces a vector of the first N integers.
This isn’t just some Turing award lecture (as if there were such a thing). This is one of the most influential lectures in our industries history.
And now you also know where the term vector comes from in the STL.
Several people have pointed out that
std::iota() was not standardized until C++11, and question why would the committee choose a name from ancient history. The
iota() algorithm was used in the first HP implementation of STL but was cut in an effort to reduce the size of STL for standardization. However,
iota() survived in the SGI distribution and was included in most other STL distributions, and
iota() was defined in the
std namespace. This means at the time of standardization it was a function in common use, for over 25 years, and the committee was standardizing common practice. That is part of what the committee does. In fact, many people thought
iota() was standard prior to its inclusion in C++11.
So even if Aras didn’t know the whole history going back to APL, as a senior professional engineer working not just as a programmer, but as a C++ developer, this was a particularly embarrassing comment.
When I first saw iota in STL I remember trying to parse the acronym in my head. It wasn’t until I read the description that I realized, “As in ι from APL!”. For those of us who where at a university in the early ’80s, some familiarity with APL would not have been uncommon and Ken’s lecture was required reading.
I’ve also received criticism for conjecturing that Ken borrowed
iota from inclusion maps in mathematics. Why would I conjecture this? Because Ken was a mathematician whose work centered around extending mathematic notation to cover sequential processes. In one of his earliest papers from 1957 he introduces ι notation:
The identity permutation vector ι is defined by the relation … The expression denotes the identification vector of the set , defined as the set considered as a vector.
That is, is a form of an inclusion map between a vector and set.
I don’t know this for certain, unfortunately we can’t ask Ken, and to my own embarrassment, I’m not that well versed in inclusion maps. I’ll ask Alex next time we get together (if you don’t know, Alex is a bit of a mathematics history buff - and also very smart).
The use of ι in APL is both a simplification and generalization of this original concept.
iota does not only appear in C++ and APL. It is a keyword to generate enum sequences in golang. I know Ken Thompson and Rob Pike have expressed a fairly strong distaste for C++, but I do not know if they borrowed this from C++ or from APL. Or just consider
iota now to be the name for such an operation.
Just as we use Ω in electrical engineering, only because the starting sound of Omega matched Ohm which is named after Georg Ohm., iota is just the name for what it is. Sure, we could use
electrical_resistance_between_two_points instead of Ω and we could use
sequential_values() instead of
iota(), we just don’t.
Yes, I replied to snark with snark. In context I make no apologies for it.
You cannot fully grasp mathematics until you understand its historical context. – Alex Stepanov