Lazy Contracts in 30 lines

1 · David Nolen · Jan. 12, 2015, midnight
Instance Level Interface (Typeclass) Extension Once again continuing previous lines of thought let's consider validations beyond :pre and :post conditions. This time we'll see how ClojureScript's specify construct allows us to trivially build a form of lazy contracts similar to those described by Findler et al.. Note: the following approach can be duplicated with deftype or reify on Clojure JVM, but specify is more succinct. Lazy contracts are useful because they allow us to lazily validate a la...