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

Implement Comparable, Sort methods #73

Open
7 tasks
MajorLift opened this issue Nov 26, 2023 · 0 comments
Open
7 tasks

Implement Comparable, Sort methods #73

MajorLift opened this issue Nov 26, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@MajorLift
Copy link
Collaborator

MajorLift commented Nov 26, 2023

Currently, we only have comparators for number types. We should implement coherent logic around handling comparable types in general.

  • List.Comparable
    • Given a comparator function F and a list T, return true iff every element of T is comparable using F.
    • (F: Kind, T: Comparable[]) --> Boolean
  • String.Compare
    • Compares two strings by alphabetical order.
    • (A: String, B: String) --> -1 | 0 | 1
  • Object.Compare
    • Compares two objects based on a given comparator.
    • (F: Kind, A: Record, B: Record) --> -1 | 0 | 1
  • List.Sort
    • Given a list T of comparable types, sort the elements using the built-in compare methods and return the result.
    • (T: Comparable[]) --> ?[]
  • List.SortOn
    • Given a comparator function F and a list T of comparable types, sort the elements using the user-supplied comparator and return the result.
    • (F: Kind, T: ?[]) --> ?[]
  • List.Max
    • Given a comparator function F and a list T of comparable types, return the maximum.
    • (F: Kind, T: Comparable[]) --> Comparable
  • List.Min
    • Given a comparator function F and a list T of comparable types, return the minimum.
    • (F: Kind, T: Comparable[]) --> Comparable

The implementation should include unit tests and JSDoc comments that adhere to the guidelines established in the style-guide/ directory.

@MajorLift MajorLift added the enhancement New feature or request label Nov 26, 2023
@MajorLift MajorLift assigned MajorLift and unassigned MajorLift Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant