Context is king!
Being Dutch, my association with iota
was the phrase “Ik snap er geen iota van” (English: “It’s all Greek to me”), basically indicating iota
is extremely small, similar to [WayBack] Iota | Definition of Iota by Merriam-Webster:
2: the 9th letter of the Greek alphabet — see alphabet table
But the first time, I saw iota
used in golang, I actually confused it with [WayBack] itoa
– C++ Reference, because I am more than slightly wordblind.
So code like this was all Greek to me at first, not understanding the conversion from integer to ASCII**, and slightly later, not understanding iota
to be extremely small either. Heck, its usage indicates it is small from infinitesimal:
const ( _ = iota // ignore first value by assigning to blank identifier KB ByteSize = 1 << (10 * iota) MB GB TB PB EB ZB YB )
So it took me a bit of thought to realise that it actually had to mean something completely different, so I found
- [WayBack] Iota · golang/go Wiki · GitHub
- [WayBack] The Go Programming Language Specification – The Go Programming Language: iota
- [WayBack] ★ Ultimate Visual Guide to Go Enums ★ – Learn Go Programming: Golang Enums & iota Guide—Full of tips and tricks with visuals and runnable code examples.
- [WayBack] go – What’s the full name for `iota` in golang? – Stack Overflow
- [WayBack] SRFI 1: List Library:
iota
count [start step] -> listReturns a list containing the elements
- [WayBack] SRFI 1: List Library:
It makes me wonder why they named it like this.
Slightly related:
- **[WayBack] c – Where did the name `atoi` come from? – Stack Overflow
Q
In the C language where did they come up with the name atoi for converting a string to an integer? The only thing I can think of is Array To Integer for an acronym but that doesn’t really make sense.
A
It means Ascii to Integer. Likewise, you can have
atol
for Ascii to Long,atof
for Ascii to Float, etc.A Google search for ‘atoi “ascii to integer”‘ confirms this on several pages.
I’m having trouble finding any official source on it… but in this listing of man pages from Third Edition Unix (1973) collected by Dennis Ritchie himself, it does contain the line:
atoi(III): convert ASCII to integer
In fact, even the first edition Unix (ca 1971) man pages list
atoi
as meaning Ascii to Integer.So even if there isn’t any documentation more official than man pages indicating that
atoi
means Ascii to Integer (I suspect there is and I just haven’t been able to locate it), it’s been Ascii to Integer by convention at least since 1971.- [WayBack] Unix V1 -> [WayBack] V1/man/man3/atoi.3:
atoi -- ascii to integer
- [WayBack] Unix V1 -> [WayBack] V1/man/man3/atoi.3:
–jeroen