updated mir interface
drug
drug2004 at bk.ru
Wed Nov 7 19:24:38 UTC 2018
On 07.11.2018 22:09, Alex wrote:
> Ok... sorry for being penetrant, but there is still something strange.
> Having dependencies as you had,
>
> ´´´
> import mir.random.algorithm;
> import mir.algorithm.iteration;
> import mir.ndslice;
> import mir.random;
>
> void fun(size_t s){}
>
> void main()
> {
> size_t[] arr;
> arr.length = 42;
>
> rne.sample(arr, 1).each!(el => fun(el));
> foreach(i; rne.sample(arr, 1)) { i.fun; }
> }
> ´´´
>
> I get
>
> /Users/alex/.dub/packages/mir-random-2.1.2/mir-random/source/mir/random/algorithm.d(573,48):
> Error: no property front for type ulong[]
> /Users/alex/.dub/packages/mir-algorithm-3.0.3/mir-algorithm/source/mir/algorithm/iteration.d-mixin-922(922,5):
> Error: template instance
> `mir.random.algorithm.RandomSample!(MersenneTwisterEngine!(ulong, 64LU,
> 312LU, 156LU, 31LU, 13043109905998158313LU, 29LU, 6148914691236517205LU,
> 17LU, 8202884508482404352LU, 37LU, 18444473444759240704LU, 43LU,
> 6364136223846793005LU), ulong[]).RandomSample.front!()` error instantiating
> /Users/alex/.dub/packages/mir-algorithm-3.0.3/mir-algorithm/source/mir/algorithm/iteration.d(966,25):
> instantiated from here: eachImpl!(__lambda1,
> RandomSample!(MersenneTwisterEngine!(ulong, 64LU, 312LU, 156LU, 31LU,
> 13043109905998158313LU, 29LU, 6148914691236517205LU, 17LU,
> 8202884508482404352LU, 37LU,18444473444759240704LU, 43LU,
> 6364136223846793005LU), ulong[]))
> source/app.d(13,20): instantiated from here:
> each!(RandomSample!(MersenneTwisterEngine!(ulong, 64LU, 312LU, 156LU,
> 31LU, 13043109905998158313LU, 29LU, 6148914691236517205LU, 17LU,
> 8202884508482404352LU, 37LU, 18444473444759240704LU, 43LU,
> 6364136223846793005LU), ulong[]))
> dmd failed with exit code 1.
>
> If I import in mir.random.algorithm.d (2.1.2) in line 534 std.range, the
> error goes away. But I assume, that's not the way it should be solved,
> is it?
It's not a full answer, but try to add `import std.array;` or its analog
in mir if exists
More information about the Digitalmars-d-learn
mailing list