He didn't know one iota.

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.

I posted a follow-up thread on Twitter to clarify the comment, but the article and criticism have spread to reddit, Slack, Disqus comments, and emails. So I’m writing an expanded follow-up here.

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 they are 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 ignorance.

To put this in context. My tweet 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 history of the iota name choice:

Ken Iverson’s work on APL greatly influenced STL. 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.

Iverson’s isn’t just some Turing award lecture (as if there were such things). This is one of the most influential lectures in our industry’s 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 the committee would choose a name from ancient history. The iota() algorithm was used in the first HP implementation of STL but was cut 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. 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. Many people thought iota() was standard before its inclusion in C++11.

So this was a particularly embarrassing comment 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.

The first reference I can find to iota() in generic programming is from 1986, Using Tournament Trees To Sort, in Scheme. And it was also part of A Library of Generic Algorithms in Ada from 1987.

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 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 suspect 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 $\iota_{j} = j$… The expression $\iota(B)$ denotes the identification vector of the set $B$, defined as the set considered as a vector.

$\iota(B)$ is a form of an inclusion map between a vector and set.

I don’t know this for sure. Unfortunately, we can’t ask Ken, and I’m not that well-versed in inclusion maps, to my embarrassment. I’ll ask Alex next time we get together (if you don’t know, Alex is a bit of a mathematics history buff).

In APL, the use of ι is both a simplification and generalization of this original concept.

And iota does not only appear in C++ and APL. It is a keyword to generate enum sequences in golang. Ken Thompson and Rob Pike have expressed a reasonably strong distaste for C++, but I do not know if they borrowed this from C++ or APL. Or 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