I’m sorry if I misunderstood your comment, but this example is not using the same list shuffled, these are different lists. I believe the result provided is the expected one?
If I reuse the example from your issue it seems fine too:
iex(1)> ~W(a A b) |> Enum.sort_by(&{String.downcase(&1), &1})
["A", "a", "b"]
iex(2)> ~W(A b a) |> Enum.sort_by(&{String.downcase(&1), &1})
["A", "a", "b"]






















