[Issue 13107] New: std.range.table
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Jul 12 04:58:57 PDT 2014
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 at puremagic.com
Reporter: bearophile_hugs at 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
--
More information about the Digitalmars-d-bugs
mailing list