www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Stupid little iota of an idea

reply foobar <foo bar.com> writes:
Andrei Alexandrescu Wrote:

 
 I don't find the name "iota" stupid.
 
 Andrei

Of course _you_ don't. However practically all the users _do_ find it poorly named, including other developers in the project.. This is the umpteenth time this comes up in the NG and incidentally this is the only reason I know what the function does. If the users think the name is stupid than it really is. That's how usability works and the fact the you think otherwise or that it might be more accurate mathematically is really not relevant. If you want D/Phobos to be used by other people besides yourself you need to cater for their requirements.
Feb 11 2011
next sibling parent "Nick Sabalausky" <a a.a> writes:
"foobar" <foo bar.com> wrote in message news:ij3cal$cee$1 digitalmars.com...
 Andrei Alexandrescu Wrote:

 I don't find the name "iota" stupid.

 Andrei

Of course _you_ don't. However practically all the users _do_ find it poorly named, including other developers in the project.. This is the umpteenth time this comes up in the NG and incidentally this is the only reason I know what the function does. If the users think the name is stupid than it really is. That's how usability works and the fact the you think otherwise or that it might be more accurate mathematically is really not relevant. If you want D/Phobos to be used by other people besides yourself you need to cater for their requirements.

I'd bet that most of the people looking at D's "filtering even numbers" example over at ( https://gist.github.com/817504 ) are thinking, "WTF is 'iota'?" (Either that or "What the hell is he converting to ASCII for?")
Feb 11 2011
prev sibling next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/11/11 7:07 AM, foobar wrote:
 Andrei Alexandrescu Wrote:

 I don't find the name "iota" stupid.

 Andrei

Of course _you_ don't. However practically all the users _do_ find it poorly named, including other developers in the project.. This is the umpteenth time this comes up in the NG and incidentally this is the only reason I know what the function does. If the users think the name is stupid than it really is. That's how usability works and the fact the you think otherwise or that it might be more accurate mathematically is really not relevant. If you want D/Phobos to be used by other people besides yourself you need to cater for their requirements.

Not all users dislike iota, and besides arguments ad populum are fallacious. Iota rocks. But have at it - vote away, and I'll be glad if a better name for iota comes about. Andrei
Feb 11 2011
next sibling parent reply so <so so.so> writes:
 Not all users dislike iota, and besides arguments ad populum are  
 fallacious. Iota rocks. But have at it - vote away, and I'll be glad if  
 a better name for iota comes about.

 Andrei

You asked for it! atob(1, 6) // easy to mix things like atoi ptoq(1, 6) // rocks imo!
Feb 11 2011
next sibling parent Daniel Gibson <metalcaedes gmail.com> writes:
Am 12.02.2011 01:46, schrieb so:
 atob(1, 6) // easy to mix things like atoi
 ptoq(1, 6) // rocks imo!

walk(1, 6) // now you have admit this is the best.

Hmm I do kind of like it.
Feb 11 2011
prev sibling parent reply Christopher Nicholson-Sauls <ibisbasenji gmail.com> writes:
On 02/11/11 18:46, so wrote:
 atob(1, 6) // easy to mix things like atoi
 ptoq(1, 6) // rocks imo!

walk(1, 6) // now you have admit this is the best.

I dunno. When I see 'walk' I think of collections, not ranges. But... I don't think it'd be terribly ambiguous, at least. For the record... I "get" the iota name... and I don't buy the eye-ambiguity with itoa. We should be using to!string, yes? But I'd be happy to see a more descriptive name, so keep at it. -- Chris N-S
Feb 12 2011
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/12/11 3:59 AM, Christopher Nicholson-Sauls wrote:
 On 02/11/11 18:46, so wrote:
 atob(1, 6) // easy to mix things like atoi
 ptoq(1, 6) // rocks imo!

walk(1, 6) // now you have admit this is the best.

I dunno. When I see 'walk' I think of collections, not ranges. But... I don't think it'd be terribly ambiguous, at least. For the record... I "get" the iota name... and I don't buy the eye-ambiguity with itoa. We should be using to!string, yes? But I'd be happy to see a more descriptive name, so keep at it. -- Chris N-S

Look how iota fans are coming out of the woodwork! :o) Andrei
Feb 12 2011
prev sibling next sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 12:55 AM, Andrei Alexandrescu wrote:
 Not all users dislike iota, and besides arguments ad populum are fallacious.
 Iota rocks. But have at it - vote away, and I'll be glad if a better name for
 iota comes about.

Proposed "interval" (which I understand as a quasi-synonym of range, apart from D's use of the term). 1-2 more people seemed to find it appropriate. Bearophile argued interval is ok but too long for such a common (?)(*) feature. What do you think? Denis (*) The notion is indeed somewhat common in code, but we have i..j for the most common cases, by far. iota() is only for when we need an assignable value representing an interval. -- _________________ vita es estrany spir.wikidot.com
Feb 11 2011
prev sibling next sibling parent so <so so.so> writes:
 atob(1, 6) // easy to mix things like atoi
 ptoq(1, 6) // rocks imo!

walk(1, 6) // now you have admit this is the best.
Feb 11 2011
prev sibling next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
Andrei:

 Not all users dislike iota,

A poll will tell how much this statement is true :-)
 and besides arguments ad populum are fallacious.

That's true for scientific and engineering (or medical, etc) things but names are not a science. The process of choosing names is part of ergonomics, it must deal with what people, with what they find closer to their mind, culture, brain. Python developers discuss carefully about naming, and indeed, Python names are sometimes better than Phobos ones. One of the problems here is that the mind of every person, you, me, Walter's has "quirks", that is mind processes not shared by most other people. So if a single person chooses names, those quirks come out, and the names are uniform (because they are chosen using the same strategy, and this is positive), but sometimes they also reflect those quirks. The only way I know to avoid this problem is to design names using polls :-)
 Iota rocks. But have at it - vote away, and I'll be glad if 
 a better name for iota comes about.

I am not going to invent a new wonderful name for it, sorry :-) My votes, in decreasing order of preference: 1) By far, a syntax like a..b:c, or missing that, a syntax like a..b 2) If first class interval syntax is really not possible, then my second choice is a function named "range". This is what Python uses, it's natural, short enough, and good. 3) If you refuse the word "range", then my third choice is "interval". It's as cleas as range, but it's a bit worse because it's longer. 4) My fourth choice is "iota". It's short and it sticks in mind. Bye, bearophile
Feb 11 2011
next sibling parent reply Michel Fortin <michel.fortin michelf.com> writes:
On 2011-02-11 19:55:05 -0500, bearophile <bearophileHUGS lycos.com> said:

 I am not going to invent a new wonderful name for it, sorry :-) My 
 votes, in decreasing order of preference:
 1) By far, a syntax like a..b:c, or missing that, a syntax like a..b

No one noticed yet that the a..b:c syntax causes ambiguity? Tell me, how do you rewrite this using the new proposed syntax: auto aa = [iota(a, b, c): 1, iota(d, e): 2];
 3) If you refuse the word "range", then my third choice is "interval". 
 It's as cleas as range, but it's a bit worse because it's longer.

Interval is clear only as long as there's no step value mentioned. Having a step value is quite a stretch from the usual notion of an interval. I like a lot so's suggestion "walk". I'm not sure it's much clearer than iota though. -- Michel Fortin michel.fortin michelf.com http://michelf.com/
Feb 11 2011
next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
Michel Fortin:

 No one noticed yet that the a..b:c syntax causes ambiguity? Tell me, 
 how do you rewrite this using the new proposed syntax:
 
 	auto aa = [iota(a, b, c): 1, iota(d, e): 2];

Right, that's why in another post I have said that syntax replaces most iota usages. There are some situations where you can't use it well. This is another situation I've shown in the enhancement request: iota(10.,20.) Writing it like this is not sane: 10...20.
 Interval is clear only as long as there's no step value mentioned. 
 Having a step value is quite a stretch from the usual notion of an 
 interval.

Right, but I think it's acceptable still, and better than iota.
 I like a lot so's suggestion "walk". I'm not sure it's much clearer 
 than iota though.

It's better than iota, but not by much. Bye, bearophile
Feb 11 2011
next sibling parent reply Daniel Gibson <metalcaedes gmail.com> writes:
Am 12.02.2011 02:25, schrieb bearophile:
 Michel Fortin:
 
 No one noticed yet that the a..b:c syntax causes ambiguity? Tell me, 
 how do you rewrite this using the new proposed syntax:

 	auto aa = [iota(a, b, c): 1, iota(d, e): 2];

Right, that's why in another post I have said that syntax replaces most iota usages. There are some situations where you can't use it well. This is another situation I've shown in the enhancement request: iota(10.,20.) Writing it like this is not sane: 10...20.
 Interval is clear only as long as there's no step value mentioned. 
 Having a step value is quite a stretch from the usual notion of an 
 interval.

Right, but I think it's acceptable still, and better than iota.
 I like a lot so's suggestion "walk". I'm not sure it's much clearer 
 than iota though.

It's better than iota, but not by much. Bye, bearophile

I think it's much better. Even having "steps" (or a stepsize) is obvious with walk. iota only makes sense when you know this from other languages/libraries or if your native spoken language has a similar word that can be somehow connected. http://en.wiktionary.org/wiki/iota doesn't give a real connection (and two English->German dictionaries I've checked don't either - one only listed iota as the greek letter, the other had mentions about something tiny) - it's just something small like that greek i-without-a-dot letter. There's nothing that connects it to a range of values with a fixed step size. Cheers, - Daniel
Feb 11 2011
next sibling parent Daniel Gibson <metalcaedes gmail.com> writes:
Am 12.02.2011 04:49, schrieb spir:
 On 02/12/2011 02:36 AM, Daniel Gibson wrote:
 Am 12.02.2011 02:25, schrieb bearophile:
 Michel Fortin:

 No one noticed yet that the a..b:c syntax causes ambiguity? Tell me,
 how do you rewrite this using the new proposed syntax:

     auto aa = [iota(a, b, c): 1, iota(d, e): 2];

Right, that's why in another post I have said that syntax replaces most iota usages. There are some situations where you can't use it well. This is another situation I've shown in the enhancement request: iota(10.,20.) Writing it like this is not sane: 10...20.
 Interval is clear only as long as there's no step value mentioned.
 Having a step value is quite a stretch from the usual notion of an
 interval.

Right, but I think it's acceptable still, and better than iota.
 I like a lot so's suggestion "walk". I'm not sure it's much clearer
 than iota though.

It's better than iota, but not by much. Bye, bearophile

I think it's much better. Even having "steps" (or a stepsize) is obvious with walk. iota only makes sense when you know this from other languages/libraries or if your native spoken language has a similar word that can be somehow connected. http://en.wiktionary.org/wiki/iota doesn't give a real connection (and two English->German dictionaries I've checked don't either - one only listed iota as the greek letter, the other had mentions about something tiny) - it's just something small like that greek i-without-a-dot letter. There's nothing that connects it to a range of values with a fixed step size.

That page looks listing various meanings in foreign languages, but mostly stincks with the greek letter; it does not mention any sense everday sense iota actually has. Example fro fr.wiktionary: # Nom de ι, Ι, neuvième lettre et quatrième voyelle de l’alphabet grec. Équivalent du i latin. # Petite quantité négligeable, presque rien. Free translation: little negligible quantity, nearly nothing. There are good chances iota has a similar meaning in numerous languages, especially romance ones. Bearophile, Andrei? Denis

I don't think a iota representing something small is too helpful. iota() produces a (possibly very long) range of values with a possibly huge step size (but even with a fixed step size of one it wouldn't make much sense to me). Cheers, - Daniel
Feb 11 2011
prev sibling parent Christopher Nicholson-Sauls <ibisbasenji gmail.com> writes:
On 02/11/11 19:36, Daniel Gibson wrote:
 Am 12.02.2011 02:25, schrieb bearophile:
 Michel Fortin:

 No one noticed yet that the a..b:c syntax causes ambiguity? Tell me, 
 how do you rewrite this using the new proposed syntax:

 	auto aa = [iota(a, b, c): 1, iota(d, e): 2];

Right, that's why in another post I have said that syntax replaces most iota usages. There are some situations where you can't use it well. This is another situation I've shown in the enhancement request: iota(10.,20.) Writing it like this is not sane: 10...20.
 Interval is clear only as long as there's no step value mentioned. 
 Having a step value is quite a stretch from the usual notion of an 
 interval.

Right, but I think it's acceptable still, and better than iota.
 I like a lot so's suggestion "walk". I'm not sure it's much clearer 
 than iota though.

It's better than iota, but not by much. Bye, bearophile

I think it's much better. Even having "steps" (or a stepsize) is obvious with walk. iota only makes sense when you know this from other languages/libraries or if your native spoken language has a similar word that can be somehow connected. http://en.wiktionary.org/wiki/iota doesn't give a real connection (and two English->German dictionaries I've checked don't either - one only listed iota as the greek letter, the other had mentions about something tiny) - it's just something small like that greek i-without-a-dot letter. There's nothing that connects it to a range of values with a fixed step size. Cheers, - Daniel

We have a related usage around here, but it's probably a local thing (western Kentucky). I grew up hearing "iota" as a word for the shortest/smallest distance/difference between two things, or (indirectly) the frequency of a thing. Not really an argument in favor of the name, mind you; but the usage had to originate from *somewhere* and so I submit that it has probably never been "official" but yet common at various times and places. -- Chris N-S
Feb 12 2011
prev sibling parent reply Jacob Carlborg <doob me.com> writes:
On 2011-02-12 02:25, bearophile wrote:
 Michel Fortin:

 No one noticed yet that the a..b:c syntax causes ambiguity? Tell me,
 how do you rewrite this using the new proposed syntax:

 	auto aa = [iota(a, b, c): 1, iota(d, e): 2];

Right, that's why in another post I have said that syntax replaces most iota usages. There are some situations where you can't use it well. This is another situation I've shown in the enhancement request: iota(10.,20.) Writing it like this is not sane: 10...20.

Why can't we just get rid of that floating point literal syntax, it just causes problem.
 Interval is clear only as long as there's no step value mentioned.
 Having a step value is quite a stretch from the usual notion of an
 interval.

Right, but I think it's acceptable still, and better than iota.
 I like a lot so's suggestion "walk". I'm not sure it's much clearer
 than iota though.

It's better than iota, but not by much. Bye, bearophile

-- /Jacob Carlborg
Feb 12 2011
next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
Jacob Carlborg:

 Why can't we just get rid of that floating point literal syntax, it just 
 causes problem.

I agree, the interval syntax (with or without optional stride) may be allowed for integral values only. (Elsewhere I have even suggested to disallow number literals like 1. or .1 :-) ) Bye, bearophile
Feb 12 2011
parent Jacob Carlborg <doob me.com> writes:
On 2011-02-12 18:18, bearophile wrote:
 Jacob Carlborg:

 Why can't we just get rid of that floating point literal syntax, it just
 causes problem.

I agree, the interval syntax (with or without optional stride) may be allowed for integral values only. (Elsewhere I have even suggested to disallow number literals like 1. or .1 :-) )

I was actually referring to this.
 Bye,
 bearophile

-- /Jacob Carlborg
Feb 12 2011
prev sibling parent "Nick Sabalausky" <a a.a> writes:
"Jacob Carlborg" <doob me.com> wrote in message 
news:ij6emq$27so$2 digitalmars.com...
 On 2011-02-12 02:25, bearophile wrote:
 Michel Fortin:

 No one noticed yet that the a..b:c syntax causes ambiguity? Tell me,
 how do you rewrite this using the new proposed syntax:

 auto aa = [iota(a, b, c): 1, iota(d, e): 2];

Right, that's why in another post I have said that syntax replaces most iota usages. There are some situations where you can't use it well. This is another situation I've shown in the enhancement request: iota(10.,20.) Writing it like this is not sane: 10...20.

Why can't we just get rid of that floating point literal syntax, it just causes problem.

It's another one of those things, like octal literals, that are there just because Walter likes it.
Feb 12 2011
prev sibling next sibling parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

spir wrote:
 On 02/12/2011 03:05 AM, Jonathan M Davis wrote:
 While iota isn't clear, it _does_ have the advantage that you're
 not going to _mis_understand

Maybe you say this because iota does not mean anything for you (?). I can easily imagine various appropriate uses of iota in a PL, like: =20 * smallest representable value in a given numeric format * threshold over which some measure should be taken into account * threshold under which some difference should be ignored * range for approximate equality (approxEquals: |x - y| < iota) * tolerance interval of technical measures (similar) * ...what else? =20

Which is actually how I interpreted =E2=80=9Ciota=E2=80=9D the first time= I saw it (since it was obvious from the context that it was a range). Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Feb 12 2011
prev sibling next sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 09:44 AM, "Jérôme M. Berger" wrote:
 spir wrote:
 On 02/12/2011 03:05 AM, Jonathan M Davis wrote:
 While iota isn't clear, it _does_ have the advantage that you're
 not going to _mis_understand

Maybe you say this because iota does not mean anything for you (?). I can easily imagine various appropriate uses of iota in a PL, like: * smallest representable value in a given numeric format * threshold over which some measure should be taken into account * threshold under which some difference should be ignored * range for approximate equality (approxEquals: |x - y|< iota) * tolerance interval of technical measures (similar) * ...what else?

Which is actually how I interpreted “iota” the first time I saw it (since it was obvious from the context that it was a range).

Makes sense for me as well. Denis -- _________________ vita es estrany spir.wikidot.com
Feb 12 2011
prev sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
Jonathan M Davis:

 interval is slightly better, but as you mention, the step value muddles that 
 abstraction.

It's not muddled enough to make it worse than iota(). "iota" has nearly no relation with its purpose in Phobos.
 genSequence is pretty much the only 
 thing that I've been able to think of that I like at all,

sequence(10,20,2) is another option, as long as "interval".
 So, if we want to actually vote on this, then we should 
 come up with a set of suggestions for the name and then start a new thread
vote 
 the vote.

I agree, in such things you need a two step process, as in brainstorming a phase of inflation and ideas creation, followed by the phase phase of critical thinking and choice. Bye, bearphile
Feb 12 2011
next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/12/11 5:02 AM, bearophile wrote:
 Jonathan M Davis:

 interval is slightly better, but as you mention, the step value muddles that
 abstraction.

It's not muddled enough to make it worse than iota(). "iota" has nearly no relation with its purpose in Phobos.

And that's part of what makes it best. Andrei
Feb 12 2011
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Andrei:

 It's not muddled enough to make it worse than iota(). "iota" has nearly no
relation with its purpose in Phobos.

And that's part of what makes it best.

To design APIs for other people you have to understand why this is awfully wrong. Bye, bearophile
Feb 12 2011
prev sibling next sibling parent reply bearophile <bearophileHUGS lycos.com> writes:
Jonathan M Davis:

 On Saturday 12 February 2011 03:25:29 Andrei Alexandrescu wrote:
 And that's part of what makes it best.

Agreed.

If you agree on that, then you can't be a designer for a public API. Bye, bearophile
Feb 12 2011
next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/12/11 8:40 AM, Andrej Mitrovic wrote:
 Nonsense is the part of what makes it best? This one goes in my
 favorite quotes bin.

Better put it in that bin with quotes taken out of context. Andrei
Feb 12 2011
prev sibling next sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/12/11 8:21 AM, bearophile wrote:
 Jonathan M Davis:

 On Saturday 12 February 2011 03:25:29 Andrei Alexandrescu wrote:
 And that's part of what makes it best.

Agreed.

If you agree on that, then you can't be a designer for a public API.

Oops. Someone stop the release of 2.052 NOW! :o) Andrei
Feb 12 2011
parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Jonathan M Davis wrote:
 you're not going to misunderstand what it [iota] means based on its nam=

=20

based on its name. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Feb 12 2011
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday 12 February 2011 07:34:43 Andrei Alexandrescu wrote:
 On 2/12/11 8:21 AM, bearophile wrote:
 Jonathan M Davis:
 On Saturday 12 February 2011 03:25:29 Andrei Alexandrescu wrote:
 And that's part of what makes it best.

Agreed.

If you agree on that, then you can't be a designer for a public API.

Oops. Someone stop the release of 2.052 NOW! :o)

LOL. It would be true that I have now named a rather large portion of the functions in Phobos now thanks to std.datetime. However, those tend to have very descriptive names. They also tended to be functions which were relatively easy to name. Honestly, I never would have named iota iota. It isn't descriptive at all. But given that we already _have_ the name and there is a precedent for it, I see no reason to change it. It's short and memorable, and you're not going to misunderstand what it means based on its name. So, no I wouldn't have chosen iota if I were naming it, but I don't think that it's worth breaking code for now. Since we have it, I say take advantage of the fact that it's short and memorable and just leave it. - Jonathan M Davis
Feb 12 2011
prev sibling parent reply Max Samukha <maxsamukha spambox.com> writes:
On 02/12/2011 04:52 PM, Jonathan M Davis wrote:
 On Saturday 12 February 2011 06:21:15 bearophile wrote:
 Jonathan M Davis:
 On Saturday 12 February 2011 03:25:29 Andrei Alexandrescu wrote:
 And that's part of what makes it best.

Agreed.

If you agree on that, then you can't be a designer for a public API.

I'm not saying that you should typically pick function names that way. But given that we already have iota, have already had iota for some time, and that there is already a C++ function by the same name that does the same thing, I see no reason to change it. It's nice and memorable, and it doesn't create confusion based on misunderstanding its name. Sure, a name that clearly says what it does would be nice, but I don't really like any of the names that have been suggested, and iota has worked just fine thus far.

Andrei's minion in me is feeling the urge to add that "iota" is also used in Go (for generating consecutive integers at compile-time, http://golang.org/doc/go_spec.html#Iota), and since Go is supposed to grow popular, "iota" will gain more popularity as well.
 I'm not suggesting that we go and name functions sigma and gamma or xyzzy or
 whatnot just because they mean nothing and are memorable. I'm saying that
 because we already have a function name which is memorable, I see no reason to
 exchange for one less memorable just because the name is nonsensical. It's
 useful in well-used functions to have short, memorable names, and iota fits
that
 to a t.

 - Jonathan M Davis

Feb 12 2011
parent Max Samukha <maxsamukha spambox.com> writes:
On 02/12/2011 07:12 PM, retard wrote:
 You're just arguing against his principles:

 "..besides arguments ad populum are fallacious"

 http://www.digitalmars.com/webnews/newsgroups.php?
 art_group=digitalmars.D&article_id=129453

Yes, I use ad populum all the time for its effectiveness. I'll try to wriggle out by saying it was not an argument for "iota" but rather counterargument to the ad populum argument that "iota" is bad since it exists only in the long-forgotten APL and an unknown C++ extension.
Feb 12 2011
prev sibling next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/12/11 6:52 AM, spir wrote:
 On 02/12/2011 12:25 PM, Andrei Alexandrescu wrote:
 On 2/12/11 5:02 AM, bearophile wrote:
 Jonathan M Davis:

 interval is slightly better, but as you mention, the step value
 muddles that
 abstraction.

It's not muddled enough to make it worse than iota(). "iota" has nearly no relation with its purpose in Phobos.

And that's part of what makes it best.

What about a random name generator to define a language.stdlib's lexicon? Then run a post-filter fed by user complaints about given names actually suggesting some relation to any [part|aspect] of their sense. denis

What I meant was that "iota" is not confusable with other concepts in Phobos, while at the same time being evocative for the task at hand. Another evocative term would be "quanta", but somehow I suspect that will enjoy little traction. :o) Andrei
Feb 12 2011
prev sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 02:05 PM, Andrei Alexandrescu wrote:
 On 2/12/11 6:52 AM, spir wrote:
 On 02/12/2011 12:25 PM, Andrei Alexandrescu wrote:
 On 2/12/11 5:02 AM, bearophile wrote:
 Jonathan M Davis:

 interval is slightly better, but as you mention, the step value
 muddles that
 abstraction.

It's not muddled enough to make it worse than iota(). "iota" has nearly no relation with its purpose in Phobos.

And that's part of what makes it best.

What about a random name generator to define a language.stdlib's lexicon? Then run a post-filter fed by user complaints about given names actually suggesting some relation to any [part|aspect] of their sense. denis

What I meant was that "iota" is not confusable with other concepts in Phobos, while at the same time being evocative for the task at hand. Another evocative term would be "quanta", but somehow I suspect that will enjoy little traction. :o)

Sorry for the somewhat humourous (?) reply above. Your statement shocked me a bit (quite the opposite of what i think is good in design --for public use). Now, I very much agree that <"iota" is not confusable with other concepts in Phobos> is a very good property. And to clore my participation to this debate: I would not mind "iota" to remain, anyway not everyday use feature. But I think it's good we have discussed this point at length, for other features, present & future. "On the importance of proper naming." (for others' benefit) Denis -- _________________ vita es estrany spir.wikidot.com
Feb 12 2011
prev sibling next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/12/11 5:02 AM, bearophile wrote:
 Jonathan M Davis:

 interval is slightly better, but as you mention, the step value muddles that
 abstraction.

It's not muddled enough to make it worse than iota(). "iota" has nearly no relation with its purpose in Phobos.
 genSequence is pretty much the only
 thing that I've been able to think of that I like at all,

sequence(10,20,2) is another option, as long as "interval".

Taken, see std.range.sequence. Andrei
Feb 12 2011
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Saturday 12 February 2011 03:25:29 Andrei Alexandrescu wrote:
 On 2/12/11 5:02 AM, bearophile wrote:
 Jonathan M Davis:
 interval is slightly better, but as you mention, the step value muddles
 that abstraction.

It's not muddled enough to make it worse than iota(). "iota" has nearly no relation with its purpose in Phobos.

And that's part of what makes it best.

Agreed. - Jonathan M Davis
Feb 12 2011
prev sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Nonsense is the part of what makes it best? This one goes in my
favorite quotes bin.
Feb 12 2011
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Friday, February 11, 2011 17:02:18 Michel Fortin wrote:
 On 2011-02-11 19:55:05 -0500, bearophile <bearophileHUGS lycos.com> said:
 I am not going to invent a new wonderful name for it, sorry :-) My
 votes, in decreasing order of preference:
 1) By far, a syntax like a..b:c, or missing that, a syntax like a..b

No one noticed yet that the a..b:c syntax causes ambiguity? Tell me, how do you rewrite this using the new proposed syntax: auto aa = [iota(a, b, c): 1, iota(d, e): 2];
 3) If you refuse the word "range", then my third choice is "interval".
 It's as cleas as range, but it's a bit worse because it's longer.

Interval is clear only as long as there's no step value mentioned. Having a step value is quite a stretch from the usual notion of an interval. I like a lot so's suggestion "walk". I'm not sure it's much clearer than iota though.

Honestly, I'd prefer iota to walk or interval. I see walk and I think about walkLength. It certainly isn't enough to tell me what the function does. interval is slightly better, but as you mention, the step value muddles that abstraction. While iota isn't clear, it _does_ have the advantage that you're not going to _mis_understand what it does based on its name, and it is _highly_ memorable. It's also short, which is nice. genSequence is pretty much the only thing that I've been able to think of that I like at all, but I'm perfectly fine with keeping iota, honestly. It's short, and I'll actually remember it, even if I don't use it all of the time. The thing about this kind of voting though is that it's likely that all of the folks who dislike the status quo will comment/complain and vote, whereas the people who don't really care or who actually really like the status quo mostly probably already stop reading this thread and won't say anything. So, it will look like the consensus is that the status quo is bad even if the majority actually don't agree. So, if we want to actually vote on this, then we should come up with a set of suggestions for the name and then start a new thread vote the vote. Personally, I'd just as soon leave iota as-is. - Jonathan M Davis
Feb 11 2011
prev sibling next sibling parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

spir wrote:
 On 02/12/2011 01:55 AM, bearophile wrote:
 4) My fourth choice is "iota". It's short and it sticks in mind.

'=CE=A8' "psi" (beeing the forelast letter of the alphabet, just before=

 omega, as everyone knows) would nicely suggest we're dealing with
 intervals half-open on the right-hand side.
=20

Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Feb 12 2011
prev sibling parent reply Olivier Pisano <olivier.pisano laposte.net> writes:
Le 12/02/11 01:55, bearophile a crit :
 Andrei:

 Not all users dislike iota,

A poll will tell how much this statement is true :-)
 and besides arguments ad populum are fallacious.

That's true for scientific and engineering (or medical, etc) things but names are not a science. The process of choosing names is part of ergonomics, it must deal with what people, with what they find closer to their mind, culture, brain. Python developers discuss carefully about naming, and indeed, Python names are sometimes better than Phobos ones. One of the problems here is that the mind of every person, you, me, Walter's has "quirks", that is mind processes not shared by most other people. So if a single person chooses names, those quirks come out, and the names are uniform (because they are chosen using the same strategy, and this is positive), but sometimes they also reflect those quirks. The only way I know to avoid this problem is to design names using polls :-)

I fully agree with you Bearophile.
 Iota rocks. But have at it - vote away, and I'll be glad if
 a better name for iota comes about.

I am not going to invent a new wonderful name for it, sorry :-) My votes, in decreasing order of preference: 1) By far, a syntax like a..b:c, or missing that, a syntax like a..b 2) If first class interval syntax is really not possible, then my second choice is a function named "range". This is what Python uses, it's natural, short enough, and good. 3) If you refuse the word "range", then my third choice is "interval". It's as cleas as range, but it's a bit worse because it's longer. 4) My fourth choice is "iota". It's short and it sticks in mind.

I am certainly not a regular poster here, so my opinion is likely to be less taken into account, but as a simple D user whose primary language is not English, here is my humble contribution (FWIW) : 1) I'd like to have the a..b syntax. 2) I think I like "interval" the most. It is certainly longer than iota to write, but as code is certainly much more read than written, I think it is an acceptable tradeoff. I guess Phobos does already functions with names longer than 7 chars, doesn't it ? If you take Andrei's example : filter!`a % 2 == 0`(iota(1, 5)) and filter!`a % 2 == 0`(interval(1, 5)) I believe the second is likely to be more informative in terms of what the function does to a newcoming user. Interval comes from latin and latin-derived languages are quite widespread around the world. According to Google : Spanish: intervalo Portugese: intervalo French: intervalle Italian: intervallo Romanian: interval BTW, musical theory does use the same vocabulary (intervals and steps), it is certainly not a valid argument, but as music one of the most universal thing on this earth, I find it amusing. 3) I don't think "range" should be used here. I love it in Python, but Range does refer to a more generic concept in D. Using range as a function name could add some confusion. 4) I believe a function name should tell what it does. An alphabet letter (greek or not) is a poor indication and should be avoided. "sum" is a more reasonable choice than "epsilon", even if that what we all write in math. My two cents, Olivier
Feb 12 2011
parent reply Olivier Pisano <olivier.pisano laposte.net> writes:
Le 12/02/11 10:36, Olivier Pisano a crit :
 4) I believe a function name should tell what it does. An alphabet
 letter (greek or not) is a poor indication and should be avoided. "sum"
 is a more reasonable choice than "epsilon", even if that what we all
 write in math.

Damn fever, I meant Sigma, of course, not epsilon...
Feb 12 2011
next sibling parent Christopher Nicholson-Sauls <ibisbasenji gmail.com> writes:
On 02/12/11 04:08, Olivier Pisano wrote:
 Le 12/02/11 10:36, Olivier Pisano a écrit :
 4) I believe a function name should tell what it does. An alphabet
 letter (greek or not) is a poor indication and should be avoided. "sum"
 is a more reasonable choice than "epsilon", even if that what we all
 write in math.

Damn fever, I meant Sigma, of course, not epsilon...

Was gonna say... thought epsilon meant "nothing" which is quite apart from "sum." Either that, or we've just waxed existential in this discussion. __ -- Chris N-S
Feb 12 2011
prev sibling parent "Nick Sabalausky" <a a.a> writes:
"Olivier Pisano" <olivier.pisano laposte.net> wrote in message 
news:ij5mb2$spd$1 digitalmars.com...
 Le 12/02/11 10:36, Olivier Pisano a crit :
 4) I believe a function name should tell what it does. An alphabet
 letter (greek or not) is a poor indication and should be avoided. "sum"
 is a more reasonable choice than "epsilon", even if that what we all
 write in math.

Damn fever, I meant Sigma, of course, not epsilon...

Perfect example of why using letter names should be avoided! :)
Feb 12 2011
prev sibling next sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 01:26 AM, so wrote:
 Not all users dislike iota, and besides arguments ad populum are fallacious.
 Iota rocks. But have at it - vote away, and I'll be glad if a better name for
 iota comes about.

 Andrei

You asked for it! atob(1, 6) // easy to mix things like atoi ptoq(1, 6) // rocks imo!

alias retro!iota atoi; Actually, I like the term iota very much; would enjoy finding a good use for it. Something related to tolerance interval, for instance, like in production of mechanical parts. Really fits the notion of "a difference small enough to make no difference". Denis -- _________________ vita es estrany spir.wikidot.com
Feb 11 2011
prev sibling next sibling parent reply Walter Bright <newshound2 digitalmars.com> writes:
Andrei Alexandrescu wrote:
 Not all users dislike iota, and besides arguments ad populum are 
 fallacious. Iota rocks. But have at it - vote away, and I'll be glad if 
 a better name for iota comes about.

delta
Feb 11 2011
parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Walter Bright wrote:
 Andrei Alexandrescu wrote:
 Not all users dislike iota, and besides arguments ad populum are
 fallacious. Iota rocks. But have at it - vote away, and I'll be glad
 if a better name for iota comes about.

=20 delta

represent a difference. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Feb 12 2011
prev sibling next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 2/12/11, Walter Bright <newshound2 digitalmars.com> wrote:
 Andrei Alexandrescu wrote:
 Not all users dislike iota, and besides arguments ad populum are
 fallacious. Iota rocks. But have at it - vote away, and I'll be glad if
 a better name for iota comes about.

delta

Now that's sexy. Makes me feel like a commander when coding D. In fact, let me dust off my old C&C cd's, I'm in the mood for some RTS.
Feb 11 2011
parent "Nick Sabalausky" <a a.a> writes:
"Andrej Mitrovic" <andrej.mitrovich gmail.com> wrote in message 
news:mailman.1524.1297475525.4748.digitalmars-d puremagic.com...
 On 2/12/11, Walter Bright <newshound2 digitalmars.com> wrote:
 Andrei Alexandrescu wrote:
 Not all users dislike iota, and besides arguments ad populum are
 fallacious. Iota rocks. But have at it - vote away, and I'll be glad if
 a better name for iota comes about.

delta

Now that's sexy. Makes me feel like a commander when coding D. In fact, let me dust off my old C&C cd's, I'm in the mood for some RTS.

I was just thinking Delta Force. Sniping 6-pixel-tall soldiers from across a voxel canyon == amazingly fantastic eye-straining fun :) Bravo team, do you read me?!? Heh, speaking of great military fun: http://unconventional-airsoft.com/2003/01/15/hand-signals-defined/
Feb 11 2011
prev sibling next sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 01:55 AM, bearophile wrote:
 4) My fourth choice is "iota". It's short and it sticks in mind.

'Ψ' "psi" (beeing the forelast letter of the alphabet, just before omega, as everyone knows) would nicely suggest we're dealing with intervals half-open on the right-hand side. Denis -- _________________ vita es estrany spir.wikidot.com
Feb 11 2011
prev sibling next sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 02:40 AM, Walter Bright wrote:
 Andrei Alexandrescu wrote:
 Not all users dislike iota, and besides arguments ad populum are fallacious.
 Iota rocks. But have at it - vote away, and I'll be glad if a better name for
 iota comes about.

delta

Like it, but for a single step (of arbitrary size, and direction). Misses the idea "series of..." I guess. Denis -- _________________ vita es estrany spir.wikidot.com
Feb 12 2011
prev sibling next sibling parent J Chapman <johnch_atms hotmail.com> writes:
series
Feb 12 2011
prev sibling next sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 01:46 PM, J Chapman wrote:
 series

Unfortunately series in maths means the sum of a sequence (at least in F, but I bet the same applies in E). Rather evokes accum/reduce/fold (for people who think at the sense in maths). Denis -- _________________ vita es estrany spir.wikidot.com
Feb 12 2011
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On 2011-02-12 00:55, Andrei Alexandrescu wrote:
 On 2/11/11 7:07 AM, foobar wrote:
 Andrei Alexandrescu Wrote:

 I don't find the name "iota" stupid.

 Andrei

Of course _you_ don't. However practically all the users _do_ find it poorly named, including other developers in the project.. This is the umpteenth time this comes up in the NG and incidentally this is the only reason I know what the function does. If the users think the name is stupid than it really is. That's how usability works and the fact the you think otherwise or that it might be more accurate mathematically is really not relevant. If you want D/Phobos to be used by other people besides yourself you need to cater for their requirements.

Not all users dislike iota, and besides arguments ad populum are fallacious. Iota rocks. But have at it - vote away, and I'll be glad if a better name for iota comes about. Andrei

I vote: 1) 1 .. 4 2) range If we ever get the uniform function call syntax in D then this could work: 1.upto(4) -- /Jacob Carlborg
Feb 12 2011
prev sibling next sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 06:02 PM, Jacob Carlborg wrote:
 On 2011-02-12 00:55, Andrei Alexandrescu wrote:
 On 2/11/11 7:07 AM, foobar wrote:
 Andrei Alexandrescu Wrote:

 I don't find the name "iota" stupid.

 Andrei

Of course _you_ don't. However practically all the users _do_ find it poorly named, including other developers in the project.. This is the umpteenth time this comes up in the NG and incidentally this is the only reason I know what the function does. If the users think the name is stupid than it really is. That's how usability works and the fact the you think otherwise or that it might be more accurate mathematically is really not relevant. If you want D/Phobos to be used by other people besides yourself you need to cater for their requirements.

Not all users dislike iota, and besides arguments ad populum are fallacious. Iota rocks. But have at it - vote away, and I'll be glad if a better name for iota comes about. Andrei

I vote: 1) 1 .. 4 2) range If we ever get the uniform function call syntax in D then this could work: 1.upto(4)

counter(1,9, 2) // ? Denis -- _________________ vita es estrany spir.wikidot.com
Feb 12 2011
prev sibling next sibling parent Peter Alexander <peter.alexander.au gmail.com> writes:
On 11/02/11 11:55 PM, Andrei Alexandrescu wrote:
 Not all users dislike iota, and besides arguments ad populum are
 fallacious. Iota rocks. But have at it - vote away, and I'll be glad if
 a better name for iota comes about.

 Andrei

finiteArithmeticProgression :-) Come on! It's the only name that's actually correct so far! Seriously though, my list of preferences would be: - Add a..b syntax, and something non-ambiguous for steps. - iota(a, b, c), because it's short and has the same meaning elsewhere. - step(a, b, c), again because it's short, but also meaningful interval is bad because it doesn't imply a step. range is bad because it already has a meaning in Phobos. delta is bad because it means a difference, not a sequence.
Feb 12 2011
prev sibling next sibling parent reply "Nick Sabalausky" <a a.a> writes:
"Andrei Alexandrescu" <SeeWebsiteForEmail erdani.org> wrote in message 
news:ij4iel$ig$2 digitalmars.com...
 On 2/11/11 7:07 AM, foobar wrote:
 Andrei Alexandrescu Wrote:

 I don't find the name "iota" stupid.

 Andrei

Of course _you_ don't. However practically all the users _do_ find it poorly named, including other developers in the project.. This is the umpteenth time this comes up in the NG and incidentally this is the only reason I know what the function does. If the users think the name is stupid than it really is. That's how usability works and the fact the you think otherwise or that it might be more accurate mathematically is really not relevant. If you want D/Phobos to be used by other people besides yourself you need to cater for their requirements.

Not all users dislike iota, and besides arguments ad populum are fallacious. Iota rocks. But have at it - vote away, and I'll be glad if a better name for iota comes about.

I vote "a..b:c" and "step"
Feb 12 2011
next sibling parent bearophile <bearophileHUGS lycos.com> writes:
Andrej Mitrovic:

 I'd maybe vote for the syntax change.
 
 But maybe we could extend the array slice syntax to construct ranges:
 
 filter!`a % 2 == 0`([1..5])
 auto r = [0 .. 5];
 
 So if the slice sits on its own it becomes a range. Or is this too
 scary/ambiguous?

In Python there are list comp. and iterators, so for me a syntax like [1..5] means something like array(iota(1,5)) while 1..5 means something like iota(1,5). Bye, bearophile
Feb 12 2011
prev sibling parent reply Peter Alexander <peter.alexander.au gmail.com> writes:
On 12/02/11 9:16 PM, Nick Sabalausky wrote:
 "Andrei Alexandrescu"<SeeWebsiteForEmail erdani.org>  wrote in message
 Not all users dislike iota, and besides arguments ad populum are
 fallacious. Iota rocks. But have at it - vote away, and I'll be glad if a
 better name for iota comes about.

I vote "a..b:c" and "step"

As Michel pointed out, a..b:c is ambiguous. auto foo = [ 1..10 : 2, 2..20 : 3 ]; Is foo an AA of ranges to ints, or an array of stepped ranges?
Feb 12 2011
parent bearophile <bearophileHUGS lycos.com> writes:
Peter Alexander:

 As Michel pointed out, a..b:c is ambiguous.
 
 auto foo = [ 1..10 : 2, 2..20 : 3 ];
 
 Is foo an AA of ranges to ints, or an array of stepped ranges?

Lazy strided intervals as associative array keys is not a common need. But there are few other situations: auto r = pred ? 1..10 : 2 : 2..20 : 3; Where the range syntax is not usable you may use the function from Phobos as fall-back: auto r = pred ? iota(1,10,2) : iota(2,20,3); A possible alternative is to require parentheses where the syntax is ambiguous: auto foo = [(1..10 : 2), (2..20 : 3)]; auto r = pred ? (1..10 : 2) : (2..20 : 3); Another alternative is to use .. to separate the stride too: auto foo = [1..10..2, 2..20..3]; auto r = pred ? 1..10..2 : 2..20..3; In this post I have assumed that the interval syntax is usable on integral values only. For floating point ones you use iota again: iota(1.0, 10.0, 0.5) Bye, bearophile
Feb 12 2011
prev sibling next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I'd maybe vote for the syntax change.

But maybe we could extend the array slice syntax to construct ranges:

filter!`a % 2 == 0`([1..5])
auto r = [0 .. 5];

So if the slice sits on its own it becomes a range. Or is this too
scary/ambiguous?

I don't really like them alone:
filter!`a % 2 == 0`(1..5)
auto r = 0 .. 5;

Otherwise I'd probably vote for "walk", or if we can't settle as a
majority on a word I guess we'll just stick to iota and that will be
the end of it. I don't hate it but newbies will be confused with it.

But you're only a newbie once, right? :)
Feb 12 2011
parent "Nick Sabalausky" <a a.a> writes:
"Andrej Mitrovic" <andrej.mitrovich gmail.com> wrote in message 
news:mailman.1581.1297547851.4748.digitalmars-d puremagic.com...
 I'd maybe vote for the syntax change.

 But maybe we could extend the array slice syntax to construct ranges:

 filter!`a % 2 == 0`([1..5])
 auto r = [0 .. 5];

 So if the slice sits on its own it becomes a range. Or is this too
 scary/ambiguous?

I like that. It also avoids this ambiguity: class Foo { opSlice(int a, int b) {} opIndex(R)(R r) if(isSomeRange!R) {} } auto f = new Foo(); f[1..5] // opSlice with ints, or opIndex with a range? If a..b requires [] to be a range literal, then the above is unambiguously an opSlice with ints, and calling opIndex with a range literal would be f[[1..5]]. Not sure why anyone would ever index on a range though, outside of operator overload abuse.
Feb 12 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
On 2/12/11, Peter Alexander <peter.alexander.au gmail.com> wrote:
 On 12/02/11 9:16 PM, Nick Sabalausky wrote:
 "Andrei Alexandrescu"<SeeWebsiteForEmail erdani.org>  wrote in message
 Not all users dislike iota, and besides arguments ad populum are
 fallacious. Iota rocks. But have at it - vote away, and I'll be glad if a
 better name for iota comes about.

I vote "a..b:c" and "step"

As Michel pointed out, a..b:c is ambiguous. auto foo = [ 1..10 : 2, 2..20 : 3 ]; Is foo an AA of ranges to ints, or an array of stepped ranges?

array of stepped ranges: auto foo = [[1..10 : 2], [2..20 : 3]]; output: [[1, 3, 5, 7, 9], [2, 5, 8, 11, 14, 17]] AA of ranges to ints: auto foo = [[1..10] : 2, [2..20] : 3]; output: [1, 2, 3, 4, 5, 6, 7, 8, 9]:2 [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]:3 iota vs new syntax: auto iot1 = [iota(1,10,2), iota(2, 20, 3)]; // array auto iot2 = [iota(1,10) : 2, iota(2, 20) : 3]; // AA auto syn1 = [[1..10 : 2], [2..20 : 3]]; // array auto syn2 = [[1..10] : 2, [2..20] : 3]; // AA
Feb 12 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
But again, I don't know who uses ranges as keys to an AA. So my guess
is you would see this very rarely in code, so it's not a fair
comparison to iota. It does show that in this case there's no
ambiguity, unless I'm mistaken.
Feb 12 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
This would make more sense as a comparison:

    auto iot1 = [iota(0, 10, 2), iota(0, 10, 3)];
    auto iot2 = [2 : iota(0, 10, 2), 3 : iota(0, 10, 3)];

    auto syn1 = [[0..10 : 2], [0..10 : 3]];
    auto syn2 = [2: [0..10 : 2], 3: [0..10 : 3]];

    // iot1 == [[0, 2, 4, 6, 8], [0, 3, 6, 9]]
    // iot2 == 2:[0, 2, 4, 6, 8] 3:[0, 3, 6, 9]

    assert(iot1 == syn1);
    assert(iot2 == syn2);
Feb 12 2011
prev sibling next sibling parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
    foreach (step; steps)
    {
        writeln( [iota(min, max, step), iota(min, max, step+1)] );
        writeln( [[min..max : step], [min..max : step+1]] );

        max += step;
    }

Sorry for spamming. :)

I'm getting more and more convinced to join the iota camp. The new
syntax barely saves any characters, and is potentially confusing.
Feb 12 2011
prev sibling next sibling parent "Simen kjaeraas" <simen.kjaras gmail.com> writes:
Nick Sabalausky <a a.a> wrote:

 f[1..5] // opSlice with ints, or opIndex with a range?

This is also an interesting point. If a..b were to be a separate type, opSlice would no longer need to exist, it could be a simple overload of opIndex. This would easily enable multi-dimensional slicing, which currently is impossible in D (barring tricks like using opIndex behind the scenes and a struct with overloaded slicing to create the slice indices: foo[ _[0..1], _[2..3] ];). -- Simen
Feb 12 2011
prev sibling parent Bruno Medeiros <brunodomedeiros+spam com.gmail> writes:
On 11/02/2011 23:55, Andrei Alexandrescu wrote:
 On 2/11/11 7:07 AM, foobar wrote:
 Andrei Alexandrescu Wrote:

 I don't find the name "iota" stupid.

 Andrei



I want to make a few comments, arising from several different posts in this discussion. First, before this discussion that Ary started, I had heard the "iota" function being mentioned a few times in other NG posts, and although I wasn't 100% sure of what it did, I did deduce it returned a sequence of numbers (in range API). And also I assumed this number sequence was related to some concept in mathematics called iota (like a Fibonacci sequence, or the factors in a Taylor series, etc.). I found now that such is not the case, the term iota as used in D was introduced by the APL language, but is not defined or well-known in mathematics academia. Generally speaking I agree with with Ary's idea of having better, more descriptive names. But I am not sure I agree what would be a better alternative. I find the name "iota" to be meaningless, but "range" for example is worse because its meaning conflicts with the general meaning of D "ranges". Conflicts in the sense that although iota(...) does return a range, it does something quite more specific. I would rather introduce a new term ("iota"), than use a confusing or overlapping one like "range" (or even "interval"). I might prefer the function to be called "numberSequence" or "numberSeq", but I don't yet have a strong enough opinion to actually cast a vote. -- Bruno Medeiros - Software Engineer
Feb 16 2011
prev sibling next sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 01:46 AM, so wrote:
 atob(1, 6) // easy to mix things like atoi
 ptoq(1, 6) // rocks imo!

walk(1, 6) // now you have admit this is the best.

Not bad, after all walk is a series of steps ;-) Denis -- _________________ vita es estrany spir.wikidot.com
Feb 11 2011
prev sibling parent spir <denis.spir gmail.com> writes:
On 02/12/2011 10:57 PM, Andrej Mitrovic wrote:
 I'd maybe vote for the syntax change.

 But maybe we could extend the array slice syntax to construct ranges:

 filter!`a % 2 == 0`([1..5])
 auto r = [0 .. 5];

 So if the slice sits on its own it becomes a range. Or is this too
 scary/ambiguous?

 I don't really like them alone:
 filter!`a % 2 == 0`(1..5)
 auto r = 0 .. 5;

I like your idea of [i..j] alone meaning interval. After all, that's exactly the sense, no? And (1) it solves the issue of [i..j:step] ambiguity (2) which may even extend to slices: array[1..$:3] But it's inconsistent with foreach (n; i..j) {} We should have had this syntax from the start, or we face a backward incompatible change. I would vote for it, but only because I don't have a big D code base ;-) Denis -- _________________ vita es estrany spir.wikidot.com
Feb 12 2011