What does iota of std::iota stand for?

前端 未结 5 1231
南笙
南笙 2020-12-02 06:19

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

相关标签:
5条回答
  • 2020-12-02 06:46

    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.)

    0 讨论(0)
  • 2020-12-02 06:50

    From the original SGI STL documentation:

    The name iota is taken from the programming language APL.

    In his Turing Award lecture, Ken Iverson (inventor of APL) said this:

    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 Ken 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.

    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 is a guide to parts of the Bible, 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:

    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.

    0 讨论(0)
  • 2020-12-02 06:50

    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.

    0 讨论(0)
  • 2020-12-02 06:53

    I quote from this page: iotashaming where you can find more on the subject.

    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."

    0 讨论(0)
  • 2020-12-02 07:08

    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.

    0 讨论(0)
提交回复
热议问题