Turn function into infinite range

Martin Nowak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Sep 29 10:02:36 PDT 2014


Does anyone know a construct to turn a lambda into an infinite range.

     import std.random;

     unittest
     {
         Random gen;
         foreach(v; xxx!(() => uniform(0, 100, gen)).take(10))
             writeln(v);
     }

I though I've seen this around somewhere but can no longer find it.


More information about the Digitalmars-d-learn mailing list