Bug 14562 – Support BigInt function std.range.repeat and other functions of Phobos

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-05-09T17:47:30Z
Last change time
2024-12-01T16:24:32Z
Keywords
bootcamp
Assigned to
No Owner
Creator
dennis.m.ritchie
Moved to GitHub: phobos#10129 →

Comments

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.
Comment #3 by simen.kjaras — 2018-03-31T20:44:54Z
There are extremely few cases where using a value above 2^63 for the repeat count is sensible. For the remaining 100% of cases, there's https://dlang.org/phobos/std_bigint#.BigInt.toLong.
Comment #4 by robert.schadek — 2024-12-01T16:24:32Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10129 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB