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

maximumBy and minimumBy documentation could use a little work #110

Open
Chadtech opened this issue Aug 29, 2018 · 2 comments
Open

maximumBy and minimumBy documentation could use a little work #110

Chadtech opened this issue Aug 29, 2018 · 2 comments

Comments

@Chadtech
Copy link
Collaborator

@rlefevre opened up #109 recently, and I had to look into what maximumBy and minimumBy do. I felt like the documentation was a little confusing. Like the term 'first maximum' was unintuitive to me. I guess theres no reason you couldnt have multiple maximums (if the two maximum are equal and above all the others) but its not a part of the normal connotation.

Then also, there are no code examples for these functions. There should be.

Is it just me that finds the documentation on these lacking? I dont really want to go off and fix these things up if its just me.

@rlefevre
Copy link
Contributor

rlefevre commented Aug 29, 2018

There could be several maximums, but then the function should return a List a, so the first maximum was quite clear to me, for example:

> maximumBy .val [{id=1, val=1}, {id=2, val=2}, {id=3, val=2}]
Just { id = 2, val = 2 }
    : Maybe { id : number1, val : number }

where the last two elements have the same value.

But you may be right, it could be better to return a list then to use List.head to get the "first" maximum. Maybe we could have maximums and maximum.

@Chadtech
Copy link
Collaborator Author

Oh I didnt even think about returning a list of maximums. Thats interesting. I just meant it could be phrased better. Like I would write "It returns the maximum, if there are two maximums it returns the first one" or something. In the first clause of the sentence it says what it does in the simplest and most intuitive way, in the second clause, the sentence covers this edge case thats not immediately obvious.

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