You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is one of my favorite features in D, but it took me a while to discover this.
This allows one to write pretty sophisticated lazy algorithms by just saving keeping a reference to the stack.
Ali had a great talk about this year -> http://dconf.org/2016/talks/cehreli.html
import std.concurrency: Generator,yield;
auto r = new Generator!int(
{
foreach (i; 1 .. 10)
yield(i);
});
import std.range: iota;
import std.algorithm.comparison: equal;
assert(r.equal(iota(1, 10)));
This is one of my favorite features in D, but it took me a while to discover this.
This allows one to write pretty sophisticated lazy algorithms by just saving keeping a reference to the stack.
Ali had a great talk about this year -> http://dconf.org/2016/talks/cehreli.html
https://dlang.org/library/std/concurrency/generator.html
The text was updated successfully, but these errors were encountered: