Andrei Alexandrescu wrote:
Norbert Nemec wrote:
Andrei Alexandrescu wrote:
"iota" is already present with the same semantics in 1.25 languages: C++ and Go. Anyhow, what's a better name?

For me, a Google search for "C++ iota" only returns discussions about whether such a function actually exists in the STL. Is it really in the standard?

It's not in the standard (and I haven't claimed so). It's commonly present as an extension.

Anyway: Looking at the definition of ïota in Phobos, it simply seems to be a slicing operation with a stride. Most intuitive to me would be to rename the function to "slice" and the option step to "stride"?

iota(0, 10, 2) generates the numbers 0, 2, 4, 6, 8.

http://www.digitalmars.com/d/2.0/phobos/std_range.html#iota

The name "stride" is currently used by a range adaptor that takes a range and walks it with a given stride. stride([1, 2, 3], 2) generates 1 and 2.

1 and 3, sorry.

Andrei

Reply via email to