What's the full name for `iota` in golang?
Asked Answered
P

4

55

As title, what's the full name for iota (not the usage) in golang:

const (  // iota is reset to 0
    c0 = iota  // c0 == 0
    c1 = iota  // c1 == 1
    c2 = iota  // c2 == 2
)
Prairie answered 27/7, 2015 at 10:2 Comment(7)
What do you mean by full name? It's just written as iota.Nora
I would say that the full name for "iota" is "the predeclared identifier iota" ;) (see here: golang.org/ref/spec#Iota), but I'm not sure I understand the question correctly...Regalado
@Regalado I would personally call it "auto-incrementing constant", but the official name is still iota.Nora
possible duplicate: What does iota of std::iota stand for?, Why is it Called iota? (duplicate)Anthropomorphize
"iota" is a word in the English language. I've always thought that iota in golang means iotaBiographical
Does this answer your question? What does iota of std::iota stand for?Anthropomorphize
I think the OP was asking what iota stands for similar to how atoi and itoa stands for ascii to integer and integer to ascii.Francklyn
U
65

That's the full name by itself. "iota" is the letter of the Greek alphabet. It is typical for the math notations:

You can find it in other programming languages as well (see iota in Scheme).

Unpack answered 27/7, 2015 at 10:16 Comment(4)
Further, it's an English noun according to Wiktionary: "A jot; a very small, inconsiderable quantity."Abet
I'm only a few days new to golang. while Alex's opinion is correct, the way that golang uses it makes a person think that it stands for "index of the array" since when you reference iota its showing the 0-based index value of when a constant was defined within a list - ergo, index of the array Just my 2 cents =]Doubtless
What does iota of std::iota stand for?Anthropomorphize
Yeah I was reading golangbyexample.com/iota-in-golang and it sounds like it's an acronym because they referred to it as IOTA in all caps.Tactician
V
5

I think the key point is that iota means the smallest letter of the Greek alphabet, the same meaning as 0 being the smallest value of an enum type.

Quoted from Wiki:

Etymology

From Ancient Greek ἰῶτα (iôta).

(jot): In reference to a phrase in the New Testament: "until heaven and earth pass away, not an iota, not a dot, will pass from the Law" (Mt 5:18), iota being the smallest letter of the Greek alphabet.

Vive answered 19/5, 2020 at 11:13 Comment(0)
S
5

iota is not an acronym for something but a word

As others pointed out it is the 9th letter of the Greek alphabet however in english it is also a word with a definition reflective of the Greek letter.

Definition of the word "iota"

From https://www.vocabulary.com/dictionary/iota

If you don't care one iota about something, it means you don’t care about it even one little bit. An iota is something very small.

From https://www.merriam-webster.com/dictionary/iota

an infinitesimal amount : JOT

did not show an iota of interest

If you think of how it is used in Go (golang) that definition fits perfectly, as you are assigning values to constants just to give each constant a unique value so it can be used as a constant. Most often you do not really care what the value is so long as it is unique among that collection of constants

Usage in APL

From http://www.randomprogramming.com/2014/07/algorithms-in-action-iota-and-shuffle/

The Greek letter iota is used in the programming language APL to generate a sequence of consecutive integers.

iota also exists in c++, So there are existing usages in other languages that are similar to Go.

Sweepstakes answered 22/12, 2020 at 19:19 Comment(0)
S
0

To be simple, it's just a Greek letter, equivalent to English letter "I", but pronounced as "iota", similar to "A" as "alpha".

Strangeness answered 30/6, 2022 at 18:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.