Re: Error when using foldl on BigInts

2019-08-10 Thread roel
Yes, I think so as well. The comment on the following proc: # This doesn't work when a = b proc multiplication(a: var BigInt, b, c: BigInt) Run is a pointer, I guess. It is called by: `*` *(a, b: BigInt): BigInt = result = zero multiplication(

Re: Error when using foldl on BigInts

2019-08-08 Thread leorize
It could be a bug in `bigints`. My stacktrace was: test.nim(24)test nim/pure/collections/sequtils.nim(727) product nimble/pkgs/bigints-0.4.3/bigints.nim(395) multiplication Run

Re: Error when using foldl on BigInts

2019-08-08 Thread roel
yeah, something is broken :(

Re: Error when using foldl on BigInts

2019-08-07 Thread nimvic
Ok thanks. But that sounds weird to use initBigInt() since it's already a seq[BigInt], isn't it?

Re: Error when using foldl on BigInts

2019-08-07 Thread roel
Changing the foldl to: foldl(data, initBigInt(a) * initBigInt(b), initBigInt(1)) Run helps.

Re: Error when using foldl on BigInts

2019-08-07 Thread gemath
Could be a problem with bounds checking, it works if compiled with `--boundChecks:off`.

Error when using foldl on BigInts

2019-08-06 Thread nimvic
Hi all, I'm pretty new to the language. I tried the following snippet: import sequtils import sugar import bigints const n = 15 proc product[T](data: seq[T]) {.thread.} = echo "data=" , data echo foldl(data, a * b) proc sum[