Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple ranks in between 2 values #28

Open
ritik5049 opened this issue Jun 4, 2024 · 2 comments
Open

Support for multiple ranks in between 2 values #28

ritik5049 opened this issue Jun 4, 2024 · 2 comments

Comments

@ritik5049
Copy link

It would be really nice if, I have 2 ranks, and want to add multiple values in between them, thus need to have a support for that.

@oliverlockwood
Copy link

Agreed.

Spelling this out at bit more, you currently have to do the following:

const x: LexoRank = /* the "before" rank */;
const y: LexoRank = /* the "after" rank */;

// to insert `n` ranks between x and y
r1: LexoRank = x.between(y);
r2: LexoRank = r1.between(y);
r3: LexoRank = r2.between(y);
...
rn: LexoRank = rm.between(y);

and of course, the space between the inserted ranks is not evenly distributed.

I envisage a new approach could be something like:

// to insert `n` ranks between x and y, **ideally with even spacing**
ranks:  LexoRank[] = x.between(y, n);

@kvandake if someone were to submit an implementation with the signature I propose here, would you consider accepting it?

oliverlockwood pushed a commit to dalet-oss/lexorank-ts that referenced this issue Oct 18, 2024
…multiple between lexoRanks based on user input (#1)

Closes issue reported on upstream repo:
kvandake#28.

A new method betweenLexoRanks has been introduced to efficiently
generate the intermediate lexoRank values in bulk. Previously, the
process involved identifying the exact middle rank each time, leading to
rapid growth of lexoRanks. The updated approach involves creating a
slice based on the desired number of lexoRanks, optimizing the
computation by using slices instead of repeatedly halving.
@oliverlockwood
Copy link

oliverlockwood commented Oct 18, 2024

@ritik5049 since this repo appears to have been abandoned by the owner, we have made and will maintain a fork at https://github.com/dalet-oss/lexorank-ts.

This particular issue has been addressed by dalet-oss#1, and the new functionality is available in @dalet-oss/lexorank version 1.1.0: https://www.npmjs.com/package/@dalet-oss/lexorank/v/1.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants