Using `lists:usort/1` might be more straightforward than `sets:to_list(sets:from_list(List))`.