February 10, 2011
Le 09/02/2011 21:08, Ary Manzana a écrit :
> On 2/9/11 3:54 PM, bearophile wrote:
>> - There is no need to learn to use a function with a weird syntax like
>> iota, coming from APL. This makes Phobos and learning D a bit simpler.
>
> I would recommend stop using "weird" names for functions. Sorry if this
> sounds a little harsh but the only reason I see this function is called
> "iota" is to demonstrate knowledge (or to sound cool). But programmers
> using a language don't care about whether the other programmer
> demonstrates knowledge behind a function name, they just want to get
> things done, fast.
>
> I mean, if I want to create a range of numbers I would search "range".
> "iota" will never, ever come to my mind. D has to be more open to
> public, not only to people who programmed in APL, Go or are mathematics
> freaks. Guess how a range is called in Ruby? That's right, Range.
>
> Another example: retro. The documentation says "iterates a bidirectional
> name backwards". Hm, where does "retro" appear in that text? If I want
> to iterate it backwards, or to reverse the order, the first thing I
> would write is reverse(range) or backwards(range), "retro" would never
> come to my mind.
>
> (and no, replies like "you can always alias xxx" are not accepted :-P)

Hi,

I agree iota is a bad name.
FWIW, what comes to my mind when I read it is an idea of tininess, such as in the expression : "It didn't change an iota". I certainly miss the mathematical reference.
Retro is self explanatory when you read it, even if it is not the first to come to mind. Backwards may have been better. Reverse is already in std.algorithm and would have confused the user.

Cheers,

Olivier.
February 10, 2011
On Wed, 09 Feb 2011 17:08:10 -0300, Ary Manzana wrote:

> On 2/9/11 3:54 PM, bearophile wrote:
>> - There is no need to learn to use a function with a weird syntax like iota, coming from APL. This makes Phobos and learning D a bit simpler.
> 
> I would recommend stop using "weird" names for functions. Sorry if this sounds a little harsh but the only reason I see this function is called "iota" is to demonstrate knowledge (or to sound cool).

I believe 'iota' got its name from its sibling in C++'s STL:

    http://www.sgi.com/tech/stl/iota.html

-Lars
February 10, 2011
On 02/09/2011 08:06 PM, Daniel Gibson wrote:
> Also using X in 1..4 is in D is pretty bad if you just want to check if 1<X<4
> (or even more when checking 1<X<100) because it has a much higher overhead -
> even though it may be technically O(1) because 4 or 100 is a constant) than just
> doing two comparisons. So IMHO using X in 1..4 or x in iota(1,4) should not be
> encouraged. (X in [1,3,4,8] is different.)

I don't understand your point, here. opIn (or rather opIn_r) ids just 2 comparisons as well for whatever represents an interval i..j. Simulation below.

Denis

struct Interval {
    int min, maxPlusOne;
    bool opIn_r (int n) {
        return (n >= min) && (n < maxPlusOne);
    }
}
unittest {
    auto ii = Interval(1,4);
    auto ints = [-1,0,1,2,3,4,5];
    foreach (i ; ints) writefln ("%s ? %s", i, i in ii);
}
==>
-1 ? false
0 ? false
1 ? true
2 ? true
3 ? true
4 ? false
5 ? false

-- 
_________________
vita es estrany
spir.wikidot.com

February 10, 2011
On 02/09/2011 09:08 PM, Ary Manzana wrote:
> On 2/9/11 3:54 PM, bearophile wrote:
>> - There is no need to learn to use a function with a weird syntax like iota,
>> coming from APL. This makes Phobos and learning D a bit simpler.
>
> I would recommend stop using "weird" names for functions. Sorry if this sounds
> a little harsh but the only reason I see this function is called "iota" is to
> demonstrate knowledge (or to sound cool). But programmers using a language
> don't care about whether the other programmer demonstrates knowledge behind a
> function name, they just want to get things done, fast.
>
> I mean, if I want to create a range of numbers I would search "range". "iota"
> will never, ever come to my mind. D has to be more open to public, not only to
> people who programmed in APL, Go or are mathematics freaks. Guess how a range
> is called in Ruby? That's right, Range.
>
> Another example: retro. The documentation says "iterates a bidirectional name
> backwards". Hm, where does "retro" appear in that text? If I want to iterate it
> backwards, or to reverse the order, the first thing I would write is
> reverse(range) or backwards(range), "retro" would never come to my mind.

I completely share your points, here.
About iota, while I cannot speak for the English language, in mine (Fr) iota means more or less <a tiny, irrelevant, difference>, typically used as "it hasn't (even) changed a iota". I can hardly make any connexion with the sense of range/interval. No idea why APL designers used this name, but for sure we should not reproduce their error.
Retro is far less problematic because at least the sense matches ;-) But I agree an unexpected name is a drawback even if semantically correct: I just spent some time searching for "reverse" precisely; I knew they func exists but...

The problems is worse in Phobos, because functionality is split across moduleaccording to a non-obvious scheme (if any) (?). In any other language, searching for a func operating of foos, you'd just explore the foo module, right? In Phobos, you need to explore foo, functional, algorithm, bar & baz, and whatnot. Plus possibly some modules outside std properly speaking (core, C libs). Very annoying. The logic should be obvious, and at best what most programmers would expect.

> (and no, replies like "you can always alias xxx" are not accepted :-P)

Certainly, because it's /highly/ important for a community of programmers to share the same "culture". And names are the main support & vehicle for this culture.

Denis

(For this reason, I stoppped aliasing size_t and size_diff_t to Ordinal and Cardinal ;-) I use uint everywhere)

-- 
_________________
vita es estrany
spir.wikidot.com

February 10, 2011
On 02/09/2011 09:09 PM, Daniel Gibson wrote:
> Am 09.02.2011 21:08, schrieb Ary Manzana:
>> On 2/9/11 3:54 PM, bearophile wrote:
>>> - There is no need to learn to use a function with a weird syntax like iota,
>>> coming from APL. This makes Phobos and learning D a bit simpler.
>>
>> I would recommend stop using "weird" names for functions. Sorry if this sounds a
>> little harsh but the only reason I see this function is called "iota" is to
>> demonstrate knowledge (or to sound cool). But programmers using a language don't
>> care about whether the other programmer demonstrates knowledge behind a function
>> name, they just want to get things done, fast.
>>
>> I mean, if I want to create a range of numbers I would search "range". "iota"
>> will never, ever come to my mind. D has to be more open to public, not only to
>> people who programmed in APL, Go or are mathematics freaks. Guess how a range is
>> called in Ruby? That's right, Range.
>>
>> Another example: retro. The documentation says "iterates a bidirectional name
>> backwards". Hm, where does "retro" appear in that text? If I want to iterate it
>> backwards, or to reverse the order, the first thing I would write is
>> reverse(range) or backwards(range), "retro" would never come to my mind.
>>
>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>
> I agree that iota is a bad name, but "Range" is a bad name because it's already
> used in D.

Use "Interval". Actually better than range, because it's an international word (thus far easier for non-native English speakers). English very often provides 2 words (typically one is germanic, the other imported); choose the international one when none is obviously better.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com

February 10, 2011
On 02/10/2011 07:30 AM, Olivier Pisano wrote:
> Le 09/02/2011 21:08, Ary Manzana a écrit :
>> On 2/9/11 3:54 PM, bearophile wrote:
>>> - There is no need to learn to use a function with a weird syntax like
>>> iota, coming from APL. This makes Phobos and learning D a bit simpler.
>>
>> I would recommend stop using "weird" names for functions. Sorry if this
>> sounds a little harsh but the only reason I see this function is called
>> "iota" is to demonstrate knowledge (or to sound cool). But programmers
>> using a language don't care about whether the other programmer
>> demonstrates knowledge behind a function name, they just want to get
>> things done, fast.
>>
>> I mean, if I want to create a range of numbers I would search "range".
>> "iota" will never, ever come to my mind. D has to be more open to
>> public, not only to people who programmed in APL, Go or are mathematics
>> freaks. Guess how a range is called in Ruby? That's right, Range.
>>
>> Another example: retro. The documentation says "iterates a bidirectional
>> name backwards". Hm, where does "retro" appear in that text? If I want
>> to iterate it backwards, or to reverse the order, the first thing I
>> would write is reverse(range) or backwards(range), "retro" would never
>> come to my mind.
>>
>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>
> Hi,
>
> I agree iota is a bad name.
> FWIW, what comes to my mind when I read it is an idea of tininess, such as in
> the expression : "It didn't change an iota". I certainly miss the mathematical
> reference.

What math sense. Maybe iota used for other meanings in english speaking math (would be surprised). I only know 2 uses: an alternative for imaginary 'i' or 'j', and the module of length 1 along X-axis.
The latter obviously has some connexion with the notion of range, but it conflicts in fact, in that iota means a /single/ unit step, and range firstly denotes a series of values, not of steps/offsets between them.

Denis
-- 
_________________
vita es estrany
spir.wikidot.com

February 10, 2011
On 2/10/11 12:30 AM, Olivier Pisano wrote:
> Le 09/02/2011 21:08, Ary Manzana a écrit :
>> On 2/9/11 3:54 PM, bearophile wrote:
>>> - There is no need to learn to use a function with a weird syntax like
>>> iota, coming from APL. This makes Phobos and learning D a bit simpler.
>>
>> I would recommend stop using "weird" names for functions. Sorry if this
>> sounds a little harsh but the only reason I see this function is called
>> "iota" is to demonstrate knowledge (or to sound cool). But programmers
>> using a language don't care about whether the other programmer
>> demonstrates knowledge behind a function name, they just want to get
>> things done, fast.
>>
>> I mean, if I want to create a range of numbers I would search "range".
>> "iota" will never, ever come to my mind. D has to be more open to
>> public, not only to people who programmed in APL, Go or are mathematics
>> freaks. Guess how a range is called in Ruby? That's right, Range.
>>
>> Another example: retro. The documentation says "iterates a bidirectional
>> name backwards". Hm, where does "retro" appear in that text? If I want
>> to iterate it backwards, or to reverse the order, the first thing I
>> would write is reverse(range) or backwards(range), "retro" would never
>> come to my mind.
>>
>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>
> Hi,
>
> I agree iota is a bad name.

Fifth result of simply googling the entire Web for "iota":

http://www.sgi.com/tech/stl/iota.html


Andrei
February 10, 2011
On 02/10/2011 05:18 PM, Andrei Alexandrescu wrote:
> On 2/10/11 12:30 AM, Olivier Pisano wrote:
>> Le 09/02/2011 21:08, Ary Manzana a écrit :
>>> On 2/9/11 3:54 PM, bearophile wrote:
>>>> - There is no need to learn to use a function with a weird syntax like
>>>> iota, coming from APL. This makes Phobos and learning D a bit simpler.
>>>
>>> I would recommend stop using "weird" names for functions. Sorry if this
>>> sounds a little harsh but the only reason I see this function is called
>>> "iota" is to demonstrate knowledge (or to sound cool). But programmers
>>> using a language don't care about whether the other programmer
>>> demonstrates knowledge behind a function name, they just want to get
>>> things done, fast.
>>>
>>> I mean, if I want to create a range of numbers I would search "range".
>>> "iota" will never, ever come to my mind. D has to be more open to
>>> public, not only to people who programmed in APL, Go or are mathematics
>>> freaks. Guess how a range is called in Ruby? That's right, Range.
>>>
>>> Another example: retro. The documentation says "iterates a bidirectional
>>> name backwards". Hm, where does "retro" appear in that text? If I want
>>> to iterate it backwards, or to reverse the order, the first thing I
>>> would write is reverse(range) or backwards(range), "retro" would never
>>> come to my mind.
>>>
>>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>>
>> Hi,
>>
>> I agree iota is a bad name.
>
> Fifth result of simply googling the entire Web for "iota":
>
> http://www.sgi.com/tech/stl/iota.html
>
>
> Andrei

Google search takes your preferences into account. They must be tracking your search history, peeking into your gmail accounts etc. I searched for 'iota' and couldn't find the STL link on the first 5 pages.
February 10, 2011
On 02/10/2011 04:34 PM, Max Samukha wrote:
> On 02/10/2011 05:18 PM, Andrei Alexandrescu wrote:
>> On 2/10/11 12:30 AM, Olivier Pisano wrote:
>>> Le 09/02/2011 21:08, Ary Manzana a écrit :
>>>> On 2/9/11 3:54 PM, bearophile wrote:
>>>>> - There is no need to learn to use a function with a weird syntax like
>>>>> iota, coming from APL. This makes Phobos and learning D a bit simpler.
>>>>
>>>> I would recommend stop using "weird" names for functions. Sorry if this
>>>> sounds a little harsh but the only reason I see this function is called
>>>> "iota" is to demonstrate knowledge (or to sound cool). But programmers
>>>> using a language don't care about whether the other programmer
>>>> demonstrates knowledge behind a function name, they just want to get
>>>> things done, fast.
>>>>
>>>> I mean, if I want to create a range of numbers I would search "range".
>>>> "iota" will never, ever come to my mind. D has to be more open to
>>>> public, not only to people who programmed in APL, Go or are mathematics
>>>> freaks. Guess how a range is called in Ruby? That's right, Range.
>>>>
>>>> Another example: retro. The documentation says "iterates a bidirectional
>>>> name backwards". Hm, where does "retro" appear in that text? If I want
>>>> to iterate it backwards, or to reverse the order, the first thing I
>>>> would write is reverse(range) or backwards(range), "retro" would never
>>>> come to my mind.
>>>>
>>>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>>>
>>> Hi,
>>>
>>> I agree iota is a bad name.
>>
>> Fifth result of simply googling the entire Web for "iota":
>>
>> http://www.sgi.com/tech/stl/iota.html
>>
>>
>> Andrei
>
> Google search takes your preferences into account. They must be tracking your
> search history, peeking into your gmail accounts etc. I searched for 'iota' and
> couldn't find the STL link on the first 5 pages.

Even then, noone forces D2 to blindly reproduce stupid naming from APL/C++, I guess. Or what?

Denis
-- 
_________________
vita es estrany
spir.wikidot.com

February 10, 2011
On 2/10/11 12:34 PM, Max Samukha wrote:
> On 02/10/2011 05:18 PM, Andrei Alexandrescu wrote:
>> On 2/10/11 12:30 AM, Olivier Pisano wrote:
>>> Le 09/02/2011 21:08, Ary Manzana a écrit :
>>>> On 2/9/11 3:54 PM, bearophile wrote:
>>>>> - There is no need to learn to use a function with a weird syntax like
>>>>> iota, coming from APL. This makes Phobos and learning D a bit simpler.
>>>>
>>>> I would recommend stop using "weird" names for functions. Sorry if this
>>>> sounds a little harsh but the only reason I see this function is called
>>>> "iota" is to demonstrate knowledge (or to sound cool). But programmers
>>>> using a language don't care about whether the other programmer
>>>> demonstrates knowledge behind a function name, they just want to get
>>>> things done, fast.
>>>>
>>>> I mean, if I want to create a range of numbers I would search "range".
>>>> "iota" will never, ever come to my mind. D has to be more open to
>>>> public, not only to people who programmed in APL, Go or are mathematics
>>>> freaks. Guess how a range is called in Ruby? That's right, Range.
>>>>
>>>> Another example: retro. The documentation says "iterates a
>>>> bidirectional
>>>> name backwards". Hm, where does "retro" appear in that text? If I want
>>>> to iterate it backwards, or to reverse the order, the first thing I
>>>> would write is reverse(range) or backwards(range), "retro" would never
>>>> come to my mind.
>>>>
>>>> (and no, replies like "you can always alias xxx" are not accepted :-P)
>>>
>>> Hi,
>>>
>>> I agree iota is a bad name.
>>
>> Fifth result of simply googling the entire Web for "iota":
>>
>> http://www.sgi.com/tech/stl/iota.html
>>
>>
>> Andrei
>
> Google search takes your preferences into account. They must be tracking
> your search history, peeking into your gmail accounts etc. I searched
> for 'iota' and couldn't find the STL link on the first 5 pages.

Same here. And 5th isn't very good. 1st is very good. :-P