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

feat: add list.sortFunc #730

Merged
merged 2 commits into from
Jan 22, 2024
Merged

Conversation

liz3
Copy link
Contributor

@liz3 liz3 commented Jan 20, 2024

feat: list.sortFunc

What's Changed:

Adds a function to list implemented in dictu which uses quickSort to allow custom sorting which is suuuper useful for a lot of problems. I would have preferred to implement this is C too but there doesn't seam to be a straight forward way to pass callbacks into c. Using a hybrid approach would have been hacky too, but of course this approach does duplicate the sorting logic.

Type of Change:

  • Bug fix
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Housekeeping:

  • Tests have been updated to reflect the changes done within this PR (if applicable).
  • Documentation has been updated to reflect the changes done within this PR (if applicable).

Adds a function to list implemented in dictu which uses quickSort
to allow custom sorting which is suuuper useful for a lot of problems.
I would have preferred to implement this is C too but there doesn't seam
to be a straight forward way to pass callbacks into c.
Using a hybrid approach would have been hacky too, but of course this approach
does duplicate the sorting logic.
@briandowns
Copy link
Contributor

LGTM

Copy link
Member

@Jason2605 Jason2605 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah unfortunately due to some optimisations in the VMs main loop it means it's no reentrant so using C wouldn't be possible in it's current state, just one little comment!

@liz3
Copy link
Contributor Author

liz3 commented Jan 22, 2024

Yeah unfortunately due to some optimisations in the VMs main loop it means it's no reentrant so using C wouldn't be possible in it's current state, just one little comment!

Is there something you wan't me to change in the PR, referencing: just one little comment!

@Jason2605
Copy link
Member

Oh what I typed out a comment 😢 it was just a note in the documentation explaining the return value of the callback and how it works essentially

@liz3
Copy link
Contributor Author

liz3 commented Jan 22, 2024

@Jason2605 done!

@Jason2605
Copy link
Member

Legend, thank you for this!

@Jason2605 Jason2605 merged commit 53af135 into dictu-lang:develop Jan 22, 2024
8 checks passed
@Jason2605 Jason2605 mentioned this pull request Sep 12, 2024
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

Successfully merging this pull request may close these issues.

3 participants