Permalink
Browse files

patched up the ns'd keywords

  • Loading branch information...
1 parent 7f4634b commit ed04bf28bcfc8a04e4cccaaab050c731c104a072 @ohpauleez committed Mar 12, 2013
Showing with 6 additions and 5 deletions.
  1. +2 −1 src/clojure/core/specs.clj
  2. +4 −4 src/clojure/core/specs/decorate.clj
@@ -104,7 +104,8 @@
`(def ~name '~spec-map)))
-(def fn-with
+(def fn-with s-decorate/fn-with)
+#_(def fn-with
"Given a spec map,
produce a function that is decorated with the spec'd keywords
TODO: rewrite this doc string"
@@ -12,15 +12,15 @@
decorate-kw))
(defmethod decorate-fn :constraints [_ spec-map f]
- (if-let [constraints (get-in spec-map [::ext :constraints])]
+ (if-let [constraints (get-in spec-map [:clojure.core.specs/ext :constraints])]
(let [pre-conditions (extract-conditions constraints :pre)
post-conditions (extract-conditions constraints :post)]
;; TODO: make this a real decorator; one that can handle var-args; Can c.c.contracts handle var args? because of the root-binding?
- (eval (list `fn (::args spec-map) {:pre pre-conditions :post post-conditions} (list* f (::args spec-map)))))
+ (eval (list `fn (:clojure.core.specs/args spec-map) {:pre pre-conditions :post post-conditions} (list* f (:clojure.core.specs/args spec-map)))))
f))
(defmethod decorate-fn :typed [_ spec-map f]
- (if-let [type-vec (get-in spec-map [::ext :typed])]
+ (if-let [type-vec (get-in spec-map [:clojure.core.specs/ext :typed])]
(do (eval (list `ann-form f (list* 'Fn type-vec)))
f)
f))
@@ -32,7 +32,7 @@
produce a function that is decorated with the spec'd keywords
TODO: rewrite this doc string"
[spec-map & kw-decs]
- (let [ret (reduce (fn [f decorate-kw] (decorate-fn decorate-kw spec-map f)) (::f spec-map) kw-decs)]
+ (let [ret (reduce (fn [f decorate-kw] (decorate-fn decorate-kw spec-map f)) (::clojure.core.specs/f spec-map) kw-decs)]
(if (symbol? ret)
(resolve ret)
ret)))

0 comments on commit ed04bf2

Please sign in to comment.