Function passed to Enum.sort/2 need to provide strict ordering, which mean that func.(a, b) == not func.(b, a) or func.(a, a) == true. This is not a case in your example.
Function passed to Enum.sort/2 need to provide strict ordering, which mean that func.(a, b) == not func.(b, a) or func.(a, a) == true. This is not a case in your example.