Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 21, 2019 What is iota function full name | ||||
---|---|---|---|---|
| ||||
Hi Guys: What is range.iota function full name |
June 21, 2019 Re: What is iota function full name | ||||
---|---|---|---|---|
| ||||
Posted in reply to lili | On Friday, 21 June 2019 at 09:01:17 UTC, lili wrote:
> Hi Guys:
> What is range.iota function full name
That is the full name. Or what do you mean?
Found on the internet somewhere:
"The function is named after the integer function ⍳ from the programming language APL."
|
June 21, 2019 Re: What is iota function full name | ||||
---|---|---|---|---|
| ||||
Posted in reply to lili | On Friday, June 21, 2019 3:01:17 AM MDT lili via Digitalmars-d-learn wrote: > Hi Guys: > What is range.iota function full name iota _is_ its full name. It's named after an STL function which does basically the same with iterators in C++: https://en.cppreference.com/w/cpp/algorithm/iota Apparently, C++ got it from the APL programming language, which uses Greek characters and other symbols that you can't find on most keyboards, which makes APL code more like what you see in equations in a math textbook, and APL uses the Greek letter iota for a function with similar behavior to the C++ and D functions. And since unlike APL, C++ couldn't use the Greek letter, when they named their version of the function, they used the name of the letter rather than the letter. And then D's function name was named after the C++ function. So, iota is the name of the function, and it doesn't stand for anything. It's just the name of the Greek letter that was used for a similar function in another language that most programmers these days have probably never heard of. - Jonathan M Davis |
June 21, 2019 Re: What is iota function full name | ||||
---|---|---|---|---|
| ||||
Posted in reply to aliak | On Friday, 21 June 2019 at 09:09:33 UTC, aliak wrote:
> On Friday, 21 June 2019 at 09:01:17 UTC, lili wrote:
>> Hi Guys:
>> What is range.iota function full name
>
> That is the full name. Or what do you mean?
>
> Found on the internet somewhere:
>
> "The function is named after the integer function ⍳ from the programming language APL."
😄 I mean is that the what is iota stands for.
in dictionary iota means:
a tiny or scarcely detectable amount
the 9th letter of the Greek alphabet
but this function is not that mean.
|
June 21, 2019 Re: What is iota function full name | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | So basically iota spills Increments Over The Array.
Am 21.06.2019 um 11:18 schrieb Jonathan M Davis:
> On Friday, June 21, 2019 3:01:17 AM MDT lili via Digitalmars-d-learn wrote:
>> Hi Guys:
>> What is range.iota function full name
>
> iota _is_ its full name. It's named after an STL function which does
> basically the same with iterators in C++:
>
> https://en.cppreference.com/w/cpp/algorithm/iota
>
> Apparently, C++ got it from the APL programming language, which uses Greek
> characters and other symbols that you can't find on most keyboards, which
> makes APL code more like what you see in equations in a math textbook, and
> APL uses the Greek letter iota for a function with similar behavior to the
> C++ and D functions. And since unlike APL, C++ couldn't use the Greek
> letter, when they named their version of the function, they used the name of
> the letter rather than the letter. And then D's function name was named
> after the C++ function. So, iota is the name of the function, and it doesn't
> stand for anything. It's just the name of the Greek letter that was used for
> a similar function in another language that most programmers these days have
> probably never heard of.
>
> - Jonathan M Davis
>
|
June 21, 2019 Re: What is iota function full name | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Friday, 21 June 2019 at 09:18:49 UTC, Jonathan M Davis wrote:
So, iota is
> the name of the function, and it doesn't stand for anything. It's just the name of the Greek letter that was used for a similar function in another language that most programmers these days have probably never heard of.
>
> - Jonathan M Davis
I don't even understand why get so much inspiration from C++. Why not just name it seq or sequence?
|
June 21, 2019 Re: What is iota function full name | ||||
---|---|---|---|---|
| ||||
Posted in reply to JN | On Friday, June 21, 2019 5:10:03 AM MDT JN via Digitalmars-d-learn wrote:
> On Friday, 21 June 2019 at 09:18:49 UTC, Jonathan M Davis wrote: So, iota is
>
> > the name of the function, and it doesn't stand for anything. It's just the name of the Greek letter that was used for a similar function in another language that most programmers these days have probably never heard of.
> >
> > - Jonathan M Davis
>
> I don't even understand why get so much inspiration from C++. Why not just name it seq or sequence?
Quite a lot of the functions in std.algorithm (especially the functions that it got early on) are modeled after similar functions in C++, standard library, and when Andrei wrote those functions, he purposefully made them use the same names as they have in C++. For anyone already familiar with those functions in C++ (including iota), having the same names makes sense. Other people are more likely to look at the names on their own merits, and as such, the names don't necessarily make as much sense (particularly iota). Regardless, given that Andrei was heavily involved in C++ long before he got involved with D, it's not exactly surprising that he'd use the C++ names rather than coming up with new ones - especially when std.algorithm was originally heavily modeled after C++'s algorithm header.
Some folks argued a while back that iota was a terrible name and that it should be changed, but it was decided not to change it. However, truth be told, if you know what iota is, the name is more descriptive than a more generic name like sequence or generateRange would be. It's just a terrible name from the perspective that it's not at all decriptive of what it is. It's just a name that has historically been used for this particular operation.
In practice, what tends to happen is that when someone first encounters iota, they think that it's a terrible name, but in the long run, they just know what it is, and it isn't actually a problem. Either way, at this point, names in Phobos don't get changed just because some folks think that a name isn't as good as it could be or should be, because changing would break code, and Walter and Andrei do not believe that simply giving something a better name is worth breaking anyone's code.
- Jonathan M Davis
|
June 21, 2019 Re: What is iota function full name | ||||
---|---|---|---|---|
| ||||
Posted in reply to lili | On Friday, 21 June 2019 at 09:24:54 UTC, lili wrote: > in dictionary iota means: > a tiny or scarcely detectable amount > the 9th letter of the Greek alphabet > but this function is not that mean. Full answer: https://stackoverflow.com/questions/9244879/what-does-iota-of-stdiota-stand-for |
June 21, 2019 Re: What is iota function full name | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jonathan M Davis | On Friday, 21 June 2019 at 12:02:10 UTC, Jonathan M Davis wrote: > On Friday, June 21, 2019 5:10:03 AM MDT JN via > Some folks argued a while back that iota was a terrible name and that it should be changed, but it was decided not to change it. auto terribleName( ... ) { } auto goodName( ... ) { pragma( inline, true ) return terribleName( ... ); } everyone is happy |
June 21, 2019 Re: What is iota function full name | ||||
---|---|---|---|---|
| ||||
Posted in reply to KnightMare | On Friday, 21 June 2019 at 19:18:02 UTC, KnightMare wrote:
> On Friday, 21 June 2019 at 12:02:10 UTC, Jonathan M Davis wrote:
>> On Friday, June 21, 2019 5:10:03 AM MDT JN via
>
>> Some folks argued a while back that iota was a terrible name and that it should be changed, but it was decided not to change it.
>
> auto terribleName( ... ) { }
>
> auto goodName( ... ) {
> pragma( inline, true )
> return terribleName( ... );
> }
>
> everyone is happy
Good tip. I usually make a file for these kind of aliases and simple functions that do not end up in the standard library, eg std.algorithm oneliners.
|
Copyright © 1999-2021 by the D Language Foundation