# Extend the domain of maximum and minimum to include empty collection?

**URL:** <https://discourse.julialang.org/t/extend-the-domain-of-maximum-and-minimum-to-include-empty-collection/5135>\
**Category:** Internals & Design\
**Tags:** question, proposal\
**Created:** [July 30, 2017, 10:21am UTC](https://discourse.julialang.org/t/extend-the-domain-of-maximum-and-minimum-to-include-empty-collection/5135 "2017-07-30T10:21:20Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![klacru](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klacru/32/27890_2.png) [@klacru](https://discourse.julialang.org/u/klacru)\
**Post date:** [August 3, 2017, 9:07am UTC](https://discourse.julialang.org/t/extend-the-domain-of-maximum-and-minimum-to-include-empty-collection/5135/22 "2017-08-03T09:07:45Z")

</div>

There seems some resistance and some technical difficulties to extend the domain of `maximum` or `minimum` to include empty collections.  
Conforming to a proposal

> [@max(x::T, y::T) and min must be commutative!](https://discourse.julialang.org/t/max-x-t-y-t-and-min-must-be-commutative/5165/11):
>
> Defining min and max to compute intersection and union has a certain appeal, but I don’t think it’s what people would really expect, and as noted would be inefficient. It seems more appropriate to introduce generic meet and join operations.

and

> [@max(x::T, y::T) and min must be commutative!](https://discourse.julialang.org/t/max-x-t-y-t-and-min-must-be-commutative/5165/15):
>
> The name join is already used for other purposes, without a corresponding meet, whereas supremum and infimum, sup and inf, lub and glb seem quite free (or if used in packages, perhaps mean more or less the same as proposed here).

I would propose to

- document the current behaviour of `maximum` and `minimum` and leave it as it is.
- implement new functions `supremum` and `infimum`, which behave equivalent for non-empty collections of totally ordered types, but cover the other cases as well.

---

_[View the full topic](https://discourse.julialang.org/t/extend-the-domain-of-maximum-and-minimum-to-include-empty-collection/5135)._
