L= [{2,2},{1,2},{2,3},{2,1}]
先根据tuple中的第二个元素排序,如果相同,则根据tuple的第一个排序
11> F3=fun({A1,A},{B1,B}) -> if A<B ->true; A==B -> if A1<B1 -> true; true -> false end ;true->false end end.
#Fun<erl_eval.12.107821302>
18> lists:sort(F3,L).
[{2,1},{1,2},{2,2},{2,3}]