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

add keepat! and insert! and pushfirst! #2936

Closed
bkamins opened this issue Nov 14, 2021 · 4 comments · Fixed by #3072
Closed

add keepat! and insert! and pushfirst! #2936

bkamins opened this issue Nov 14, 2021 · 4 comments · Fixed by #3072
Labels
Milestone

Comments

@bkamins
Copy link
Member

bkamins commented Nov 14, 2021

In the future consider adding keepat! support (introduced in Julia 1.7).

@bkamins bkamins added this to the 1.x milestone Nov 14, 2021
@bkamins bkamins changed the title add keepat! add keepat! and insert! Nov 16, 2021
@Chandu-4444
Copy link
Contributor

Can I try adding insert!? Can you tell me how and where to start writing this function?

@bkamins
Copy link
Member Author

bkamins commented Nov 22, 2021

I think insert! is hard to start with (unless you are really experienced with Julia).

You would need to use:

and define similar insert! three methods for insert!. I encourage to review this source code and decide, but you will see that it is not an easy code and insert! will be a bit more complex than push! (not much but a still).

keepat! should be much easier as you just need to call deleteat! with an inverse selector (at least in the easiest scenario, i.e. not pushing performance to the limits). The only thing to be careful about is that keepat! will either need to be imported from Base or defined internally and exported depending on Julia version the user is on.

This was referenced Nov 22, 2021
@bkamins bkamins changed the title add keepat! and insert! add keepat! and insert! and pushfirst! Nov 22, 2021
@bkamins
Copy link
Member Author

bkamins commented Nov 22, 2021

If you are looking for easy PRs I would recommend:

@bkamins bkamins modified the milestones: 1.x, 1.4 Dec 23, 2021
@bkamins
Copy link
Member Author

bkamins commented Feb 18, 2022

Also to complete the list of possible additions:

  • resize!
  • pop!
  • popat!
  • popfirst!
  • keepat!
  • insert!
  • pushfirst!
  • prepend!

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

Successfully merging a pull request may close this issue.

2 participants