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

[FR] max/maximum min/minimum #37733

Closed
juliohm opened this issue Sep 24, 2020 · 5 comments
Closed

[FR] max/maximum min/minimum #37733

juliohm opened this issue Sep 24, 2020 · 5 comments

Comments

@juliohm
Copy link
Contributor

juliohm commented Sep 24, 2020

Unlike the + operation that is binary in a given space of objects, and naturally extended to a n-ary operation via the LaTeX \sum or reduce(+, collection), the maximum and minimum of a set of objects is n-ary by definition. Currently, however, we fight with max vs. maximum every day depending on the number of arguments we have in our use cases.

I know this is a breaking suggestion, but I think it would be really helpful if the language had a single operation max(collection) that is n-ary, and ask users to simply do max((x,y)) if they need the binary particular case. Similar for the min vs. minimum battle.

Regardless of the potential breaks, do we still have time to fix this annoyance in a major release? Save those seconds looking up the docs every time we need to compute the maximum/minimum of something.

@rfourquet
Copy link
Member

Cf. #11872 and #4652 (which refers to discussion in #4235),

@bramtayl
Copy link
Contributor

Another option would be to ditch maximum or minimum altogether in favor of reduce(max/min, collection)

@JeffBezanson
Copy link
Member

Right, what's useful about 2-argument max is that it can be plugged in to reduce. There are many implementations of reduce, e.g. threaded, distributed, n-dimensional, etc. If max is in charge of iterating over the collection then conceptually max has to re-implement all of that. Of course, in practice you would define max2(x,y) = max((x,y)), but that's the indication to me that this is the wrong factoring of the functionality.

@juliohm
Copy link
Contributor Author

juliohm commented Oct 8, 2020

Closing the issue based on the up and down votes 👍

@bramtayl
Copy link
Contributor

bramtayl commented Oct 8, 2020

Ref #37944

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

4 participants