|
3425 | 3425 | `(binding [*math-context* (java.math.MathContext. ~precision ~@rm)] |
3426 | 3426 | ~@body))) |
3427 | 3427 |
|
3428 | | -(defn bound-fn |
| 3428 | +(defn mk-bound-fn |
3429 | 3429 | {:private true} |
3430 | 3430 | [#^clojure.lang.Sorted sc test key] |
3431 | 3431 | (fn [e] |
|
3436 | 3436 | >=. Returns a seq of those entries with keys ek for |
3437 | 3437 | which (test (.. sc comparator (compare ek key)) 0) is true" |
3438 | 3438 | ([#^clojure.lang.Sorted sc test key] |
3439 | | - (let [include (bound-fn sc test key)] |
| 3439 | + (let [include (mk-bound-fn sc test key)] |
3440 | 3440 | (if (#{> >=} test) |
3441 | 3441 | (when-let [[e :as s] (. sc seqFrom key true)] |
3442 | 3442 | (if (include e) s (next s))) |
3443 | 3443 | (take-while include (. sc seq true))))) |
3444 | 3444 | ([#^clojure.lang.Sorted sc start-test start-key end-test end-key] |
3445 | 3445 | (when-let [[e :as s] (. sc seqFrom start-key true)] |
3446 | | - (take-while (bound-fn sc end-test end-key) |
3447 | | - (if ((bound-fn sc start-test start-key) e) s (next s)))))) |
| 3446 | + (take-while (mk-bound-fn sc end-test end-key) |
| 3447 | + (if ((mk-bound-fn sc start-test start-key) e) s (next s)))))) |
3448 | 3448 |
|
3449 | 3449 | (defn rsubseq |
3450 | 3450 | "sc must be a sorted collection, test(s) one of <, <=, > or |
3451 | 3451 | >=. Returns a reverse seq of those entries with keys ek for |
3452 | 3452 | which (test (.. sc comparator (compare ek key)) 0) is true" |
3453 | 3453 | ([#^clojure.lang.Sorted sc test key] |
3454 | | - (let [include (bound-fn sc test key)] |
| 3454 | + (let [include (mk-bound-fn sc test key)] |
3455 | 3455 | (if (#{< <=} test) |
3456 | 3456 | (when-let [[e :as s] (. sc seqFrom key false)] |
3457 | 3457 | (if (include e) s (next s))) |
3458 | 3458 | (take-while include (. sc seq false))))) |
3459 | 3459 | ([#^clojure.lang.Sorted sc start-test start-key end-test end-key] |
3460 | 3460 | (when-let [[e :as s] (. sc seqFrom end-key false)] |
3461 | | - (take-while (bound-fn sc start-test start-key) |
3462 | | - (if ((bound-fn sc end-test end-key) e) s (next s)))))) |
| 3461 | + (take-while (mk-bound-fn sc start-test start-key) |
| 3462 | + (if ((mk-bound-fn sc end-test end-key) e) s (next s)))))) |
3463 | 3463 |
|
3464 | 3464 | (defn repeatedly |
3465 | 3465 | "Takes a function of no args, presumably with side effects, and returns an infinite |
|
0 commit comments