应将fn->comparator
调用提升
(sort (fn [x y] ((fn->comparator comp) (keyfn x) (keyfn y))) coll)
(let [comparator (fn->comparator comp)] (sort (fn [x y] (comparator (keyfn x) (keyfn y))) coll))
此外,在{{sort}}中对函数再次调用fn->comparator
,不确定如何避免,除非我们将排序代码复制到{{sort-by}}。