digitalmars.D - iota and BigInt
- Russel Winder (49/49) May 28 2013 Arising from a thread on the GoLangNuts email list, I wrote the
Arising from a thread on the GoLangNuts email list, I wrote the following: import std.algorithm: reduce; import std.bigint; import std.range: iota; import std.stdio: writeln; =20 int main(immutable string[] args) { foreach (int i; iota(10, 50, 10)) { writeln(reduce!"a * b"(BigInt(1), iota(BigInt(1), BigInt(i)))); } return 0; } =20 Sadly the compiler refuses to acknowledge that iota works for BigInt. My first assumption is that my code is wrong. My second assumption is that std.range doesn't work with real integers =E2=80=94 as opposed to those pes= ky limited hardware things ;-)=20 ./numbers_multiplePasses.d(10): Error: template std.range.iota does= not match any function template declaration. Candidates are: /usr/include/dmd/phobos/std/range.d(5107): std.range.iota(B,= E, S)(B begin, E end, S step) if ((isIntegral!(CommonType!(B, E)) || isPoi= nter!(CommonType!(B, E))) && isIntegral!(S)) /usr/include/dmd/phobos/std/range.d(5192): std.range.iota(B,= E)(B begin, E end) if (isFloatingPoint!(CommonType!(B, E))) /usr/include/dmd/phobos/std/range.d(5199): std.range.iota(B,= E)(B begin, E end) if (isIntegral!(CommonType!(B, E)) || isPointer!(Common= Type!(B, E))) /usr/include/dmd/phobos/std/range.d(5260): std.range.iota(E)= (E end) /usr/include/dmd/phobos/std/range.d(5267): std.range.iota(B,= E, S)(B begin, E end, S step) if (isFloatingPoint!(CommonType!(B, E, S))) /usr/include/dmd/phobos/std/range.d(5107): Error: template std.rang= e.iota cannot deduce template function from argument types !()(BigInt,BigIn= t) Failed: 'dmd' '-v' '-o-' './numbers_multiplePasses.d' '-I.' Thanks. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
May 28 2013