Skip to content

Array.compareWith issue #2961

Description

@ncave

The current Array.compareWith implementation in Fable is inconsistent with the F# implementation and documentation.
Here is an example:

let a = [|1;3|]
let b = [|1;2;3|]
// compares lengths first, then elements
let c1 = a < b // equals true
let c2 = compare a b // equals -1
// should compare elements first, then lengths
let c3 = Array.compareWith compare a b // equals 1 in .NET, -1 in Fable
printfn "c1 = %A, c2 = %A, c3 = %A" c1 c2 c3

I'm not sure why FSharp.Core has this inconsistent compare behavior for arrays only (unlike in other collections), but it's there, so this probably needs to be made the same in Fable.

  • Rust
  • JS
  • Python
  • Dart

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions