Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.rrb-vector by

I faced this error during I'm playing with aoc2018 d9. It seems this error pops up when the vector has items around over 2M.

Execution error (ArrayIndexOutOfBoundsException) at clojure.core.rrb-vector.rrbt/slice-left$fn (rrbt.clj:393).
Index 33 out of bounds for length 33

      rrbt.clj:  393  clojure.core.rrb-vector.rrbt/slice-left/fn
      rrbt.clj:  392  clojure.core.rrb-vector.rrbt/slice-left
      rrbt.clj:  375  clojure.core.rrb-vector.rrbt/slice-left
      rrbt.clj: 1098  clojure.core.rrb-vector.rrbt.Vector/slicev
rrb_vector.clj:   83  clojure.core.rrb-vector/subvec
rrb_vector.clj:   73  clojure.core.rrb-vector/subvec

I can't find the issue page in github, so I'd like to leave a question here to get a help.

2 Answers

+1 vote
selected by
Best answer

Which version of the core.rrb-vector are you using? Some bugs were fixed in the not-most-recent versions. The most recent release can be found at the "Released versions" link in the README here: https://github.com/clojure/core.rrb-vector/

If you can reproduce this with the latest version, I would be interested to learn how. There is still at least one known bug with the library that I am not sure how to fix, but I would not be terribly surprised if there were others that I have not seen.

Wow, thank you for your answer. I'm using the latest version 0.1.2 actually. If you want me to try the previous versions, I'm happy to do it. Currently, I can reproduce with my code below. Sorry for my lousy code ;)

You can reproduce with line 94 inside the comment block, it takes some time to run though. https://github.com/mattdamon108/first-clojure/blob/master/aoc201809.clj
I believe the latest version has the fewest bugs in it, so I would not recommend trying with older versions.  I was able to reproduce the bug on my system.  I was somewhat amused when I read your code, because one of the earlier bug reports against core.rrb-vector was also for a marble game, and probably someone writing code to solve this same 2018 Advent of Code Problem #9 that it appears you are solving.  That earlier bug was fixed, but you seem to have unearthed another I have not seen.

Frankly, I am a bit skeptical that I can figure out a way to make core.rrb-vector both (a) correct, and (b) meet the run-time that RRB trees claim to be able to achieve.

I have an idea for writing a similar library based on B-trees instead of RRB trees, but it is primarily an idea I have spent a lot of time thinking and writing about, but I have not written code for, so that approach won't help you unless you like the idea of writing such a library.

In the mean time, there is a Java library containing a class io.lacuna.bifurcan.List that _might_ have fewer bugs than core.rrb-vector, but no promises on that point: https://github.com/lacuna/bifurcan
First, I'm happy to know that I faced this error because I used this library in the wrong way, and also happy that I can report an unearthed bug.

I hope this issue will be resolved soon. I really want to use this library without any worry. I'm very satisfied with the performance of computation actually.

Thank you for letting me know the another lib io.lacuna.bifurcan.List. I'll try it.

Again thank you for your work!
+1 vote

Just FYI, this is the correct place to ask this question and we will file an issue in the internal jira system if necessary.

Thank you for your information!