On Sunday, 15 February 2015 at 22:38:20 UTC, anonymous wrote:
And more:
import std.stdio;
struct MapResult(alias fun)
{
@property int front() {return fun();}
@property auto save() {return typeof(this)();}
}
void main()
{
int ys_length = 4;
auto dg = {return MapResult!({return ys_
On Sunday, 15 February 2015 at 19:54:45 UTC, anonymous wrote:
Reduced some more:
import std.algorithm, std.stdio;
void main()
{
int ys_length = 4;
auto indices = [0]
.map!(xBase => [0].map!(y => ys_length))
.joiner();
writeln(indices);
}
And more:
import std.stdio;
On Sunday, 15 February 2015 at 18:13:44 UTC, John Colvin wrote:
Simplified from something bigger:
import std.range, std.algorithm, std.stdio;
void foo(float[] data, float[] xs, float[] ys)
{
auto indices = iota(0, data.length, ys.length)
.map!(xBase =>
iota(xBase, xB
FG:
Odd... Still something is wrong. It prints:
[0, 4, 5, 1, 1, 5, 6, 2, 2, 6, 7, 3, 4, 8, 9, 5, 5, 5, 6, 6, 6,
6, 7, 7]
instead of this:
[0, 4, 5, 1, 1, 5, 6, 2, 2, 6, 7, 3, 4, 8, 9, 5, 5, 9, 10, 6,
6, 10, 11, 7]
This is less lazy and gives another result:
import std.range, std.algorithm
On Sunday, 15 February 2015 at 18:43:35 UTC, bearophile wrote:
John Colvin:
prints things like [0, 4, 5, 1, 1, 1459971595, 1459971596, 2,
2, 1459971596, 1459971597, 3, 4, 8, 9, 5, 5, 4441427819,
4441427820, 6, 6, 4441427820, 4441427821, 7] but the output
isn't consistent, the big numbers chan
On 2015-02-15 at 19:43, bearophile wrote:
void foo(in float[] data, in float[] xs, in float[] ys) @safe {
iota(0, data.length, ys.length)
.map!(xBase => iota(xBase, xBase + ys.length - 1)
.map!(y => [y, y+ys.length, y+ys.length+1, y+1])
.joiner)
John Colvin:
prints things like [0, 4, 5, 1, 1, 1459971595, 1459971596, 2,
2, 1459971596, 1459971597, 3, 4, 8, 9, 5, 5, 4441427819,
4441427820, 6, 6, 4441427820, 4441427821, 7] but the output
isn't consistent, the big numbers change on each run.
Try to replace the only() with:
[y, y+ys.leng
Simplified from something bigger:
import std.range, std.algorithm, std.stdio;
void foo(float[] data, float[] xs, float[] ys)
{
auto indices = iota(0, data.length, ys.length)
.map!(xBase =>
iota(xBase, xBase + ys.length - 1)
.map!(y =>