Compactify a list.