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;
        
        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;
        }
        
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 — as opposed to those pesky
limited hardware things ;-) 

        ./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)) || 
isPointer!(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!(CommonType!(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.range.iota cannot deduce template function from argument types 
!()(BigInt,BigInt)
        Failed: 'dmd' '-v' '-o-' './numbers_multiplePasses.d' '-I.'

Thanks.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:[email protected]
41 Buckmaster Road    m: +44 7770 465 077   xmpp: [email protected]
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to