void sort(List& L) { List R = emptyList; for(List p = L; !isEmpty(p); p = tail(p)) { insert(head(p), R); } destroy(L); L = R; }