Permalink
Browse files

Remove backward compatibility used for Clojure 1.2

  • Loading branch information...
1 parent a13f78f commit 8d73080c0b6ad6d1bc5c9397c7de2de7f2714b2d @marick committed May 8, 2013
@@ -40,9 +40,9 @@
snd-to-last-is-as? #(= :as (second (reverse %)))
has-key-as? #(contains? % :as)]
(pred-cond arg-form
- (every-pred-m vector? snd-to-last-is-as?) [arg-form (last arg-form)]
+ (every-pred vector? snd-to-last-is-as?) [arg-form (last arg-form)]
vector? [(-> arg-form (conj :as) (conj as-symbol)) as-symbol]
- (every-pred-m map? has-key-as?) [arg-form (:as arg-form)]
+ (every-pred map? has-key-as?) [arg-form (:as arg-form)]
map? [(assoc arg-form :as as-symbol) as-symbol]
:else [arg-form arg-form] )))
@@ -59,7 +59,7 @@
(letfn [(throwable-as-desired? [throwable desideratum]
(pred-cond desideratum
fn? (desideratum throwable)
- (some-fn-m string? regex?) (extended-= (.getMessage ^Throwable throwable) desideratum)
+ (some-fn string? regex?) (extended-= (.getMessage ^Throwable throwable) desideratum)
class? (instance? desideratum throwable)))]
(defchecker throws
@@ -21,82 +21,3 @@
(move-once-to-core slingshot.ex-info [ex-info ex-data])
-(defn-once every-pred-m
- "Takes a set of predicates and returns a function f that returns true if all of its
- composing predicates return a logical true value against all of its arguments, else it returns
- false. Note that f is short-circuiting in that it will stop execution on the first
- argument that triggers a logical false result against the original predicates."
- {:added "1.3"}
- ([p]
- (fn ep1
- ([] true)
- ([x] (boolean (p x)))
- ([x y] (boolean (and (p x) (p y))))
- ([x y z] (boolean (and (p x) (p y) (p z))))
- ([x y z & args] (boolean (and (ep1 x y z)
- (every? p args))))))
- ([p1 p2]
- (fn ep2
- ([] true)
- ([x] (boolean (and (p1 x) (p2 x))))
- ([x y] (boolean (and (p1 x) (p1 y) (p2 x) (p2 y))))
- ([x y z] (boolean (and (p1 x) (p1 y) (p1 z) (p2 x) (p2 y) (p2 z))))
- ([x y z & args] (boolean (and (ep2 x y z)
- (every? #(and (p1 %) (p2 %)) args))))))
- ([p1 p2 p3]
- (fn ep3
- ([] true)
- ([x] (boolean (and (p1 x) (p2 x) (p3 x))))
- ([x y] (boolean (and (p1 x) (p2 x) (p3 x) (p1 y) (p2 y) (p3 y))))
- ([x y z] (boolean (and (p1 x) (p2 x) (p3 x) (p1 y) (p2 y) (p3 y) (p1 z) (p2 z) (p3 z))))
- ([x y z & args] (boolean (and (ep3 x y z)
- (every? #(and (p1 %) (p2 %) (p3 %)) args))))))
- ([p1 p2 p3 & ps]
- (let [ps (list* p1 p2 p3 ps)]
- (fn epn
- ([] true)
- ([x] (every? #(% x) ps))
- ([x y] (every? #(and (% x) (% y)) ps))
- ([x y z] (every? #(and (% x) (% y) (% z)) ps))
- ([x y z & args] (boolean (and (epn x y z)
- (every? #(every? % args) ps))))))))
-
-(defn-once some-fn-m
- "Takes a set of predicates and returns a function f that returns the first logical true value
- returned by one of its composing predicates against any of its arguments, else it returns
- logical false. Note that f is short-circuiting in that it will stop execution on the first
- argument that triggers a logical true result against the original predicates."
- {:added "1.3"}
- ([p]
- (fn sp1
- ([] nil)
- ([x] (p x))
- ([x y] (or (p x) (p y)))
- ([x y z] (or (p x) (p y) (p z)))
- ([x y z & args] (or (sp1 x y z)
- (some p args)))))
- ([p1 p2]
- (fn sp2
- ([] nil)
- ([x] (or (p1 x) (p2 x)))
- ([x y] (or (p1 x) (p1 y) (p2 x) (p2 y)))
- ([x y z] (or (p1 x) (p1 y) (p1 z) (p2 x) (p2 y) (p2 z)))
- ([x y z & args] (or (sp2 x y z)
- (some #(or (p1 %) (p2 %)) args)))))
- ([p1 p2 p3]
- (fn sp3
- ([] nil)
- ([x] (or (p1 x) (p2 x) (p3 x)))
- ([x y] (or (p1 x) (p2 x) (p3 x) (p1 y) (p2 y) (p3 y)))
- ([x y z] (or (p1 x) (p2 x) (p3 x) (p1 y) (p2 y) (p3 y) (p1 z) (p2 z) (p3 z)))
- ([x y z & args] (or (sp3 x y z)
- (some #(or (p1 %) (p2 %) (p3 %)) args)))))
- ([p1 p2 p3 & ps]
- (let [ps (list* p1 p2 p3 ps)]
- (fn spn
- ([] nil)
- ([x] (some #(% x) ps))
- ([x y] (some #(or (% x) (% y)) ps))
- ([x y z] (some #(or (% x) (% y) (% z)) ps))
- ([x y z & args] (or (spn x y z)
- (some #(some % args) ps)))))))
@@ -30,7 +30,7 @@
(best-lineish [arrow-loc]
(try
- ( (some-fn-m left-lineish right-lineish #(inc (previous-lineish %))) arrow-loc)
+ ( (some-fn left-lineish right-lineish #(inc (previous-lineish %))) arrow-loc)
(catch Throwable ex
;; `previous-lineish` returned nil: use the fallback-line-number
nil)))]
@@ -12,7 +12,7 @@
[form]
(let [m #(with-meta % (meta form))]
(pred-cond form
- (some-fn-m seq? list?) (m (apply list (map eagerly form)))
+ (some-fn seq? list?) (m (apply list (map eagerly form)))
vector? (m (vec (map eagerly form)))
map? (m (into form (map eagerly form)))
set? (m (into (empty form) (map eagerly form)))

0 comments on commit 8d73080

Please sign in to comment.