SHARE
TWEET

Untitled

a guest Jun 19th, 2017 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (require '[clojure.spec.alpha :as s]
  2.          '[clojure.spec.test.alpha :as ta])
  3.  
  4. (defn add [x]
  5.   (fn [y]
  6.     (+ x y)))
  7.  
  8. (s/def ::num (s/double-in :infinite? false
  9.                           :NaN? false))
  10.  
  11. (ta/check-fn add
  12.   (s/fspec :args (s/cat :x ::num)
  13.            :ret (s/fspec :args (s/cat :y ::num)
  14.                          :ret ::num)
  15.            :fn #(= (-> % :args :x) ((:ret %) 0))))
RAW Paste Data
Top