www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14562] New: Support BigInt function std.range.repeat and

https://issues.dlang.org/show_bug.cgi?id=14562

          Issue ID: 14562
           Summary: Support BigInt function std.range.repeat and other
                    functions of Phobos
           Product: D
           Version: future
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: dennis.m.ritchie mail.ru

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)
}

--
May 09 2015