Zulip Chat Archive

Stream: Is there code for X?

Topic: finset.max!


Adam Topaz (Feb 04 2022 at 22:38):

Do we have an analogue of docs#finset.max which gives a default value for empty finsets? (e.g. if T : finset nat, I it should return 0 for the empty finset).

Bhavik Mehta (Feb 04 2022 at 22:39):

You can compose the existing one with docs#option.get_or_else, or docs#option.iget

Adam Topaz (Feb 04 2022 at 22:40):

Thanks!

Yury G. Kudryashov (Feb 04 2022 at 23:00):

You can also use docs#finset.sup

Adam Topaz (Feb 04 2022 at 23:11):

Ah, that's probably better suited for my use case! Thanks!


Last updated: Dec 20 2023 at 11:08 UTC