foreach/iota countdown

Timon Gehr timon.gehr at gmx.ch
Mon Feb 17 13:06:49 PST 2014


On 02/17/2014 09:21 PM, simendsjo wrote:
> On Monday, 17 February 2014 at 20:03:32 UTC, Timon Gehr wrote:
>> ...
>>
>> It was just to illustrate the issue more clearly. Eg. it means one and
>> the same iota expression can sometimes iterate in one direction and in
>> the other direction at other times. That's simply not useful behaviour.
>
> I'm not sure what I find more confusing. Ok if it's a deliberate choice
> never to change the step direction, but is it deliberate that it's not
> an error to have a greater lower bound than upper bound? Or is this just
> the way it happened to be implemented?

That's deliberate. I don't really understand how it is confusing.

To draw an analogy, given (low ∈ ℕ)  and (high ∈ ℕ),

{ x ∈ ℕ | low ≤ x ∧ x < high }

is just the empty set if low > high. It is not illegal or unusual.


More information about the Digitalmars-d-learn mailing list