sort should accept a comparison function, optionally