Comment #0 by dennis.m.ritchie — 2015-05-09T17:47:30Z
I believe that the repeat function and other functions of Phobos, where the use BigInt appropriate, should support BigInt.
For example,
-----
import std.stdio : writeln;
import std.range : repeat;
import std.bigint : BigInt;
void main() {
int a = 4, b = 15;
writeln(a.repeat(b)); // OK
// [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
BigInt c = 4, d = 15;
// writeln(c.repeat(d)); // error
// template std.range.repeat cannot
// deduce function from argument types !()(BigInt, BigInt)
// std.range.repeat(T)(T value, size_t n)
}
Comment #1 by jack — 2015-09-04T19:17:35Z
(In reply to dennis.m.ritchie from comment #0)
> I believe that the repeat function and other functions of Phobos, where the
> use BigInt appropriate, should support BigInt.
Doing c.repeat(b) works. Honest question: do you really need the second param to also be a BigInt?
Comment #2 by dennis.m.ritchie — 2016-01-03T12:05:17Z
(In reply to Jack Stouffer from comment #1)
> Doing c.repeat(b) works. Honest question: do you really need the second
> param to also be a BigInt?
Yes, the second parameter must be the same `BigInt`, for example, to use a `repeat` in the benchmark.