I stumbled upon these cases in a one-off fsx - I'm not regularly using F#. This might be entirely my fault.
That said:
Microsoft (R) F# Interactive version 12.0.30815.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
> [| 3.2; 1.5; nan; 4.7; nan; 8.5 |] |> Array.sortBy (fun x -> x);;
val it : float [] = [|nan; nan; 1.5; 3.2; 4.7; 8.5|]
Good.
> [| 3.2; 1.5; nan; 4.7; nan; 8.5 |] |> Seq.sort;;
val it : seq<float> = seq [nan; nan; 1.5; 3.2; ...]
Fine.
> [| 3.2; 1.5; nan; 4.7; nan; 8.5 |] |> Seq.sortBy (fun x -> x);;
val it : seq<float> = seq [3.2; 1.5; nan; 4.7; ...]
What? Why?
I would expect that Array.sortBy and Seq.sortBy behave the same. And I would expect that sortBy identity is the same as sort? What's going on here?
I stumbled upon these cases in a one-off fsx - I'm not regularly using F#. This might be entirely my fault.
That said:
Microsoft (R) F# Interactive version 12.0.30815.0
Copyright (c) Microsoft Corporation. All Rights Reserved.
Good.
Fine.
What? Why?
I would expect that Array.sortBy and Seq.sortBy behave the same. And I would expect that sortBy identity is the same as sort? What's going on here?