Jump to page: 1 2
Thread overview
December 04, 2014
https://issues.dlang.org/show_bug.cgi?id=6447

--- Comment #5 from bearophile_hugs@eml.cc ---
A workaround:

10.iota.map!BigInt

--
December 05, 2014
https://issues.dlang.org/show_bug.cgi?id=6447

--- Comment #6 from hsteoh@quickfur.ath.cx ---
That doesn't help when you actually *need* a BigInt, e.g.,
iota(BigInt(2)^^65536). Of course, you'd run into other problems with that
(e.g., you'll be waiting a looong time for your program to finish), but the
idea is that you want to iterate over numbers that only BigInt can represent,
right?

--
December 05, 2014
https://issues.dlang.org/show_bug.cgi?id=6447

--- Comment #7 from bearophile_hugs@eml.cc ---
(In reply to hsteoh from comment #6)
> That doesn't help when you actually *need* a BigInt, e.g.,
> iota(BigInt(2)^^65536). Of course, you'd run into other problems with that
> (e.g., you'll be waiting a looong time for your program to finish), but the
> idea is that you want to iterate over numbers that only BigInt can
> represent, right?

The idea is that I'd like iota(BigInt(10)) to work. In the meantime I use some
workarounds.

--
December 05, 2014
https://issues.dlang.org/show_bug.cgi?id=6447

--- Comment #8 from hsteoh@quickfur.ath.cx ---
Yes, but if BigInt(10) should work, then BigInt(2)^^65536 should work too. I
don't think you'd like it if the library imposed some arbitrary subrange on
your numeric types that may be used with iota (what if iota(10) worked but
iota(11) didn't?).

--
December 05, 2014
https://issues.dlang.org/show_bug.cgi?id=6447

--- Comment #9 from bearophile_hugs@eml.cc ---
(In reply to hsteoh from comment #8)
> Yes, but if BigInt(10) should work, then BigInt(2)^^65536 should work too. I
> don't think you'd like it if the library imposed some arbitrary subrange on
> your numeric types that may be used with iota (what if iota(10) worked but
> iota(11) didn't?).

Yes, of course. I'd like iota to work with bigints in general :-)

--
January 22, 2015
https://issues.dlang.org/show_bug.cgi?id=6447

--- Comment #10 from hsteoh@quickfur.ath.cx ---
This seems to be a subset of https://issues.dlang.org/show_bug.cgi?id=10762

--
January 22, 2015
https://issues.dlang.org/show_bug.cgi?id=6447

hsteoh@quickfur.ath.cx changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #11 from hsteoh@quickfur.ath.cx ---
https://github.com/D-Programming-Language/phobos/pull/2895

--
January 26, 2015
https://issues.dlang.org/show_bug.cgi?id=6447

--- Comment #12 from github-bugzilla@puremagic.com ---
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/b159a5bdc980abb90833b32fa04044a002dfc794 Merge pull request #2895 from quickfur/iota_bigint

Issue 6447 & 10762: support user-defined types in iota()

--
January 26, 2015
https://issues.dlang.org/show_bug.cgi?id=6447

--- Comment #13 from bearophile_hugs@eml.cc ---
I keep this issue open because this still doesn't work:


void main() {
    import std.bigint: BigInt;
    import std.range: iota;
    iota(BigInt(1), BigInt(100), BigInt(5));
    iota(BigInt(1), BigInt(100), 5);
}



test.d(4,9): Error: template std.range.iota cannot deduce function from
argument types !()(BigInt, BigInt, BigInt), candidates are:
...\dmd2\src\phobos\std\range\package.d(4008,6):        std.range.iota(B, E,
S)(B begin, E end, S step) if ((isIntegral!(CommonType!(B, E)) ||
isPointer!(CommonType!(B, E))) && isIntegral!S)
...\dmd2\src\phobos\std\range\package.d(4098,6):        std.range.iota(B, E)(B
begin, E end) if (isFloatingPoint!(CommonType!(B, E)))
...\dmd2\src\phobos\std\range\package.d(4105,6):        std.range.iota(B, E)(B
begin, E end) if (isIntegral!(CommonType!(B, E)) || isPointer!(CommonType!(B,
E)))
...\dmd2\src\phobos\std\range\package.d(4168,6):        std.range.iota(E)(E
end)
...\dmd2\src\phobos\std\range\package.d(4176,6):        std.range.iota(B, E,
S)(B begin, E end, S step) if (isFloatingPoint!(CommonType!(B, E, S)))
test.d(4,9):        ... (1 more, -v to show) ...
test.d(5,9): Error: template std.range.iota cannot deduce function from
argument types !()(BigInt, BigInt, int), candidates are:
...\dmd2\src\phobos\std\range\package.d(4008,6):        std.range.iota(B, E,
S)(B begin, E end, S step) if ((isIntegral!(CommonType!(B, E)) ||
isPointer!(CommonType!(B, E))) && isIntegral!S)
...\dmd2\src\phobos\std\range\package.d(4098,6):        std.range.iota(B, E)(B
begin, E end) if (isFloatingPoint!(CommonType!(B, E)))
...\dmd2\src\phobos\std\range\package.d(4105,6):        std.range.iota(B, E)(B
begin, E end) if (isIntegral!(CommonType!(B, E)) || isPointer!(CommonType!(B,
E)))
...\dmd2\src\phobos\std\range\package.d(4168,6):        std.range.iota(E)(E
end)
...\dmd2\src\phobos\std\range\package.d(4176,6):        std.range.iota(B, E,
S)(B begin, E end, S step) if (isFloatingPoint!(CommonType!(B, E, S)))
test.d(5,9):        ... (1 more, -v to show) ...

--
January 26, 2015
https://issues.dlang.org/show_bug.cgi?id=6447

--- Comment #14 from hsteoh@quickfur.ath.cx ---
One thing at a time! The last PR implemented the iota(start,end) case. The next
step is to extend it to handle the iota(start,end,step) case when += is
supported.

--
« First   ‹ Prev
1 2