View mode: basic / threaded / horizontal-split · Log in · Help
December 24, 2010
Re: Why is D slower than LuaJIT?
spir:

> Note: Iota is right-side exclusive like i..j . (I've just been caught by this trap ;-)

This is for the better, to increase language consistency (as in Python).
In APL (where the iota name comes from) the semantics was different:
i 5 ==> 1, 2, 3, 4, 5

Integer ranges are very common, so some generalization seems useful here. The x..y:z syntax may be the range with z stride, and be syntax sugar for iota(x, y, z).

Bye,
bearophile
Top | Discussion index | About this forum | D home