sortlist xs＝sortby(\as bs-&gt;compare(length as)(length bs))xs