Open nirvdrum opened 4 years ago
Yes, I'm surprised that public static between(oLeft: LexoDecimal, oRight: LexoDecimal)
doesn't check if there is still 'place' between two ranks, so we could fallback by rebuilding the list (change buckets?) before trying to call between
again.
Full disclosure: I discover lexorank few hours ago, and there's probably something I don't understand.
I too have only just discovered this algorithm and library in the last few hours and I am also surprised that we don't have some sort of failure case that is obvious in the code 🤔 I started looking through the function and the ones that it calls and I couldn't see an obvious thrown error (at least not one that was quite as obvious as the initial check at the top of the function).
I guess I would expect the system to error in the case that there is no space and then that is a signal to the caller that it's time to rebalance. Does that sound right to people? If so then I can think about putting together a test to illustrate this situation and see if it currently throws an error 👍
As far as I can tell, this library provides everything needed to rebuild the rankings for a list. But, there doesn't appear to be a utility method to pull everything together. It'd be helpful if there were a section in the documentation on how to generate the next bucket and start re-ranking items from the old bucket into the new bucket.