digitalmars.D.learn - iota and BigInt
- Russel Winder via Digitalmars-d-learn (25/25) Jan 22 2015 Using reduce for factorial, seems to require iota, not a bad things per
Using reduce for factorial, seems to require iota, not a bad things per se, with ulongs: reduce!"a*b"(1, iota(1, n + 1)) works fine. Now switch to BigInt: reduce!"a*b"(one, iota(one, n + one)) fails to compile, one and n + one are of different types. Problem is that one is immutable but n + one is not. I can't remember how to create an immutable value as an expression so: immutable BigInt v =3D n + one; reduce!"a*b"(one, iota(one, v)) now I get an error telling me that I can't use iota because BigInt is not a float or an integer. Is this a known bug? Yes it is: https://issues.dlang.org/show_bug.cgi?id=3D6447 Does anyone know how to fix this 3.5 year old bug that is a blocker for doing anything with factorial and Fibonacci Series.? --=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
Jan 22 2015