July 12, 2009
Andrei Alexandrescu wrote:
> Benji Smith wrote:
>> Andrei Alexandrescu wrote:
>>> Anyhow... it would be a bummer if the negative atmosphere as of late in the group would cause people like you just lose interest. I can't understand what's going on.
>>
>> I think it would help if you weren't so condescending to people all the time. People don't like that much.
> 
> I understand. My perception is that negativity predates my being condescending, which roots from exasperation. For every annoying message of mine there are dozens patient messages making a similar point. But you're right, if a point is made the wrong way its correctness is not that relevant anymore.


I empathize. I enjoy issuing a sly and well-worded skewer just as much as the next guy. But, when those kinds of retorts are perceived as coming from the top down, they create resentment.

Like it or not, you're "the man".

:)

--benji
July 13, 2009
Michiel Helvensteijn wrote:
> Andrei Alexandrescu wrote:
> 
>> void main()
>> {
>>      foreach_reverse (i; 0.7 .. 100.7)
>>      {
>>          write(i, " ");
>>      }
>> }
>>
>> The last number printed is -0.3.
> 
> A question if I may.
> 
> Why does D allow iteration over an interval of floats? A floating point
> number has no direct successor or predecessor. Any such interval would
> contain zero, one or infinite elements.
> 
> Given the -0.3, I'm assuming you increase/decrease by 1.0 each iteration. Is
> this useful enough to be the standard behavior?
> 

It's a petri dish. Perfect breeding ground for bugs.

real BIG = 2.0 /(real.epsilon);

foreach(i; BIG .. BIG + 2) {
  ...
}

Infinite loop, since BIG + 1 == BIG.
July 13, 2009
Don wrote:
> Michiel Helvensteijn wrote:
>> Andrei Alexandrescu wrote:
>>
>>> void main()
>>> {
>>>      foreach_reverse (i; 0.7 .. 100.7)
>>>      {
>>>          write(i, " ");
>>>      }
>>> }
>>>
>>> The last number printed is -0.3.
>>
>> A question if I may.
>>
>> Why does D allow iteration over an interval of floats? A floating point
>> number has no direct successor or predecessor. Any such interval would
>> contain zero, one or infinite elements.
>>
>> Given the -0.3, I'm assuming you increase/decrease by 1.0 each iteration. Is
>> this useful enough to be the standard behavior?
>>
> 
> It's a petri dish. Perfect breeding ground for bugs.
> 
> real BIG = 2.0 /(real.epsilon);
> 
> foreach(i; BIG .. BIG + 2) {
>   ...
> }
> 
> Infinite loop, since BIG + 1 == BIG.


It's also inconsistent:

  foreach (e; range)      // Iterate over *all* elements in range
  foreach (i; 0..10)      // Iterate over *all* integers from 0 to 9
  foreach (f; 0.0..10.0)  // Iterate over a small subset of
                             floating-point numbers between 0 and 10

-Lars
July 13, 2009
On Mon, Jul 13, 2009 at 2:59 AM, Don<nospam@nospam.com> wrote:
> Michiel Helvensteijn wrote:
>>
>> Andrei Alexandrescu wrote:
>>
>>> void main()
>>> {
>>>     foreach_reverse (i; 0.7 .. 100.7)
>>>     {
>>>         write(i, " ");
>>>     }
>>> }
>>>
>>> The last number printed is -0.3.
>>
>> A question if I may.
>>
>> Why does D allow iteration over an interval of floats? A floating point number has no direct successor or predecessor. Any such interval would contain zero, one or infinite elements.
>>
>> Given the -0.3, I'm assuming you increase/decrease by 1.0 each iteration.
>> Is
>> this useful enough to be the standard behavior?
>>
>
> It's a petri dish. Perfect breeding ground for bugs.
>
> real BIG = 2.0 /(real.epsilon);
>
> foreach(i; BIG .. BIG + 2) {
>  ...
> }
>
> Infinite loop, since BIG + 1 == BIG.


So why do Matlab and NumPy both have such constructs (with optional stepsize)?

--bb
8 9 10 11 12 13 14 15 16 17 18
Next ›   Last »