Repository navigation
fix(js/ts/python/dart/rust/beam): break min and max ties like FSharp.Core - #5198
Open
leonitousconforti wants to merge 5 commits into
Open
leonitousconforti wants to merge 5 commits into
leonitousconforti wants to merge 5 commits into
Conversation
- List, Array and Seq minBy returned the last of the tied minima; they now return the first, and minBy and maxBy call the projection once per element instead of twice per step. - List, Array and Seq min returned the last of equal minima, visible with 1.0m and 1.00m, -0.0 and 0.0 or a custom comparison. They now return the first, like max already did. - The max operator returned its second argument when the values compare equal; it now returns the first like FSharp.Core (min already returned the second, as FSharp.Core does).
- List and Seq minBy returned the last of the tied minima; they now return the first. List, Array and Seq minBy and maxBy call the projection once per element instead of twice per step. - List and Seq min, and Array min and max, returned the last of equal elements (e.g. -0.0 and 0.0); they now return the first. - The max operator returned its second argument when the values compare equal; it now returns the first like FSharp.Core.
- List, Array and Seq minBy returned the last of the tied minima; they now return the first, and minBy and maxBy call the projection once per element instead of twice per step. - List, Array and Seq min returned the last of equal elements (e.g. with a custom comparison); they now return the first, like max already did. - The max operator returned its second argument when the values compare equal; it now returns the first like FSharp.Core.
- List, Array and Seq minBy, maxBy, min and max returned the last of tied elements; they now return the first, comparing each element with the current one like FSharp.Core. minBy and maxBy call the projection once per element instead of twice per step. - The max operator returned its second argument when the values compare equal; it now returns the first like FSharp.Core. - The decimal max and min operators used Rust's Ord::max and Ord::min, which break ties the other way round from FSharp.Core (max 1.0m 1.00m gave 1.00). They now go through Decimal max and min, which match it.
- List and Array minBy and maxBy broke key ties by comparing the elements themselves in Erlang term order, so they returned the smallest or largest of the tied elements. They now return the first, as they already did for union keys. - Seq minBy returned the last of the tied minima, and Seq min the last of equal elements; they now return the first. Seq minBy and maxBy call the projection once per element instead of twice per step.
This was referenced Oct 28, 2026
leonitousconforti
added a commit
to leonitousconforti/flip7
that referenced
this pull request
Nov 6, 2026
Only the min tie, fable-compiler/Fable#5198, is still listed. ParamName and Convert.ToHexString come from Fable now, and Assert.Throws no longer singles out a plain Exception.
leonitousconforti
added a commit
to leonitousconforti/flip7
that referenced
this pull request
Nov 6, 2026
Only the min tie, fable-compiler/Fable#5198, is still listed. ParamName and Convert.ToHexString come from Fable now, and Assert.Throws no longer singles out a plain Exception.
leonitousconforti
added a commit
to leonitousconforti/flip7
that referenced
this pull request
Nov 6, 2026
Fable's List.minBy keeps the last of a tie until fable-compiler/Fable#5198 ships, so until then the fable job fails on this game.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The min/max collection functions and the
maxoperator now pick the same element as FSharp.Core when values tie. One commit per target.List/Array/Seq.minByreturned the last of tied minima and now return the first:[ "a", 1; "b", 0; "c", 0 ] |> List.minBy sndgave("c", 0), now("b", 0).minByandmaxByalso call the projection once per element, as FSharp.Core does.List/Array/Seq.minreturned the last of equal elements:List.min [ 1.0m; 1.00m ]gave1.00, now1.0.maxoperator returned its second argument on a tie (e.g. a type with a customCompareTo). FSharp.Core returns the first.minalready matched.Array.max/minkept the last of equal elements too.maxBy/maxkept the last as well, and the decimalmax/minoperators broke ties the other way.minBy/maxBybroke key ties by Erlang term order of the elements.Notes:
minByreturns. The remaining NaN differences come fromcompareusing a total order, which seems like a separate issue.-0.0below0.0(List.min [ 0.0; -0.0 ]gives-0.0), and Rust's floatmax/minoperators usef64::max/min.