www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13107] New: std.range.table

https://issues.dlang.org/show_bug.cgi?id=13107

          Issue ID: 13107
           Summary: std.range.table
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: bearophile_hugs eml.cc

I suggest to add to Phobos a function like this:

table!func(optional_arguments)

It generates an infinite range of calls the function func. So this code:

table!uniform(0.0, 2.0)

Is similar to:

0.repeat.map!(_ => uniform(0.0, 2.0))


So to generate 100 random uniform values in [0.0, 1.0[:

table!uniform01.take(100)


It is related to this Mathematica function, but the syntax is different and
it's lazy and infinite:
http://reference.wolfram.com/language/ref/Table.html

--
Jul 12 2014