在Go语言中,`iota`的完整名称是`iota`。

huangapple go评论95阅读模式
英文:

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

问题

在Go语言中,iota的全名是"自增索引"。在常量声明中,iota用于生成一系列自增的值。在你提供的代码示例中,iota被用于创建连续递增的常量值。在每个const关键字出现时,iota都会被重置为0,并且每次出现在常量声明中时都会自增1。因此,c0的值为0,c1的值为1,c2的值为2。

英文:

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
)

答案1

得分: 60

这是它的完整名称。"iota"是希腊字母表中的一个字母。它在数学符号中很常见:

你也可以在其他编程语言中找到它(参见Scheme中的iota)。

英文:

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

答案2

得分: 4

iota不是某个东西的缩写,而是一个词。

正如其他人指出的,它是希腊字母表中的第九个字母,然而在英语中它也是一个具有希腊字母意义的词。

“iota”一词的定义

来自https://www.vocabulary.com/dictionary/iota
> 如果你对某事不在乎一点点,那意味着你对它一点都不在乎。iota是一件非常小的东西。

来自https://www.merriam-webster.com/dictionary/iota
> 无限小的量:JOT
>
> 没有表现出一点兴趣

如果你考虑它在Go(golang)中的用法,这个定义非常贴切,因为你只是为了给每个常量赋予一个唯一的值,以便它可以被用作常量。大多数情况下,你并不真正关心这个值是什么,只要它在常量集合中是唯一的即可。

在APL中的用法

来自http://www.randomprogramming.com/2014/07/algorithms-in-action-iota-and-shuffle/
> 希腊字母iota在编程语言APL中用于生成一系列连续的整数。

iota也存在于C++中,因此其他语言中存在类似于Go的用法。

英文:

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.

答案3

得分: 3

我认为关键点在于,iota意味着希腊字母表中最小的字母,与0作为枚举类型最小值的含义相同。

引用自维基百科

词源

源自古希腊语 ἰῶτα (iôta)。

(jot):指的是新约中的一句话:“我实在告诉你们,就是到天地都废去了,律法的一点一画也不能废去,都要成全。”(太 5:18),其中iota是希腊字母表中最小的字母。

英文:

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.

答案4

得分: 0

简单来说,它只是一个希腊字母,相当于英文字母"I",但发音为"iota",类似于"alpha"的发音为"A"。

英文:

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

huangapple
  • 本文由 发表于 2015年7月27日 18:02:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/31650192.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定