iota where step is a function

anonymouse anony at mouse.com
Thu May 25 00:18:44 UTC 2023


On Wednesday, 24 May 2023 at 16:39:36 UTC, Ben Jones wrote:
> Is there a range like iota in phobos where step is a function?  
> I want to specify begin/end and have the "step" be next = 
> fun(prev).  Should be easy to write, but don't want to reinvent 
> the wheel.
````D
import std.stdio;
import std.range: iota;

void main()
{
     iota(10, 0, -1).writeln;
}
````


More information about the Digitalmars-d-learn mailing list