Skip to content

Add (immutable) sort to Array #24

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

Merged
merged 2 commits into from
Feb 24, 2023
Merged

Add (immutable) sort to Array #24

merged 2 commits into from
Feb 24, 2023

Conversation

cknitt
Copy link
Member

@cknitt cknitt commented Feb 10, 2023

  • sort is the immutable version of the JS Array.sort function
  • stableSort, stableSortInPlace are the implementation from Belt
  • Use Array.sortInPlace for List.sort

@cknitt cknitt requested a review from zth February 10, 2023 09:47
@cknitt
Copy link
Member Author

cknitt commented Feb 24, 2023

It seems we do not need our own stable sort implementation.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#sort_stability

Since version 10 (or ECMAScript 2019), the specification dictates that Array.prototype.sort is stable.

@cknitt cknitt changed the title Add sort, stableSort, stableSortInPlace to Array Add sort to Array Feb 24, 2023
@cknitt cknitt changed the title Add sort to Array Add (immutable) sort to Array Feb 24, 2023
Copy link
Collaborator

@zth zth left a comment

Choose a reason for hiding this comment

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

We'll do docstrings when doing the rest of the module.

@zth zth merged commit 0ed37ec into main Feb 24, 2023
@zth zth deleted the array-sort branch February 24, 2023 17:10
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.

2 participants