File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 177177
178178(def ap " A shorthand version of applied" applied )
179179
180- (defn =to
181- " Produces an equality predicate from a single object. ((=to x) y) is
180+ (let [impl (delay (try (eval `(fn [x#]
181+ (if (keyword? x) ; ; a case myssteriously not covered in equivPred
182+ (fn [y#]
183+ (identical? x# y#))
184+ (let [p# (clojure.lang.Util/equivPred x#)]
185+ (fn [y#]
186+ (.equiv p# x# y#))))))
187+ (catch Exception e ; ; running some version prior to equivPred
188+ (fn [x] (fn [y] (= x y))))))]
189+ (defn =to
190+ " Produces an equality predicate from a single object. ((=to x) y) is
182191the same as (= x y), but if the returned function will be called many
183192times it may be more efficient than repeated calls to =, because =to
184193can short-circuit many irrelevant code paths based on knowing the type
185194of x.
186195
187196Just a wrapper for clojure.lang.Util/equivPred."
188- [x]
189- (if (keyword? x) ; ; a case myssteriously not covered in equivPred
190- (fn [y]
191- (identical? x y))
192- (let [p (clojure.lang.Util/equivPred x)]
193- (fn [y]
194- (.equiv p x y)))))
197+ [x]
198+ (@impl x)))
You can’t perform that action at this time.
0 commit comments