anchor.diff:  
   To learn more about generators, read the test.check http://clojure.github.io/test.check/intro.html[tutorial] or http://clojure.github.io/test.check/generator-examples.html[examples]. Do keep in mind that while clojure.spec.gen is a large subset of clojure.test.check.generators, not everything is included.
   
  -== Testing
  +== Instrumentation and Testing
  +
  +spec provides a set of development and testing functionality in the `clojure.spec.test` namespace, which we can include with:
  +
  +[source,clojure]
  +----
  +(require '[clojure.spec.test :as stest])
  +----
  +
  +=== Instrumentation
  +
  +Instrumentation allows us to validate the `:args` on invocation and produce an error if the call is invalid. This can be used to validate that external calls to a function conform to the spec defined via `fdef`.
  +
  +Instrumentation for our previously spec'ed `ranged-rand` function is turned on with:
  +
  +[source,clojure]
  +----
  +(stest/instrument `ranged-rand)
  +----
  +
  +Instrument takes a fully-qualified symbol so we use `pass:[`]` here to resolve it in the context of the current namespace. If the function is invoked with args that do not conform the `:args` spec you will see an error like this:
  +
  +[source,clojure]
  +----
  +(ranged-rand 8 5)
  +CompilerException clojure.lang.ExceptionInfo: Call to #'spec.examples.guide/ranged-rand did not conform to spec:
  +val: {:start 8, :end 5} fails at: [:args] predicate: (< (:start %) (:end %))
  +:clojure.spec/args  (8 5)
  +:clojure.spec/failure  :instrument-check-failed
  + #:clojure.spec{:problems [{:path [:args], :pred (< (:start %) (:end %)), :val {:start 8, :end 5}, :via [], :in []}], :args (8 5), :failure :instrument-check-failed}
  +----
  +
  +The error fails the second args predicate that checks `(< start end)`. Note that the `:ret` and `:fn` specs are not checked with instrumentation. It is expected that these specs will be checked during testing instead.
  +
  +Instrumentation can be turned off using the complementary function `unstrument`. Instrumentation is likely to be useful at development time or testing time to discover errors in other code that are invoking a function incorrectly. It is not recommended to use instrumentation in production as there is some overhead involved with checking args specs.
  +
  +=== Testing
   
   We mentioned earlier that `clojure.spec.test` provides tools for automatically testing functions. When functions have specs with generators, we can use http://clojure.github.io/clojure/branch-master/clojure.spec-api.html#clojure.spec.test/test[`test`], to automatically generate tests that check the function using the specs. 
   
  
positive.code:              #(< (:ret %) (-> % :args :end))))
  ----
  
  This function spec demonstrates a number of features. First the `:args` is a compound spec that verifies the types of the arguments. This spec is invoked with the args in a list, as if they were passed to `(apply fn (arg-list))`. Because the args are sequential and the args are positional fields, they are almost always described using a regex op, like `cat`, `alt`, or `*`. The second predicate takes as input the conformed result of the first predicate and verifies that start < end. The `:ret` value spec is also an integer. Finally, the `:fn` spec checks that the return value is >= start and < end.
  
  We can turn on instrumentation (spec checking) with:
  
  [source,clojure]
  ----
  (s/instrument `ranged-rand)
  ----
  
  Instrument takes a fully-qualified symbol so we use `pass:[`]` to resolve it in the context of the current namespace. If the args are invalid you'll see an error like this:
  
  [source,clojure]
  ----
  (ranged-rand 8 5)
  ;; CompilerException clojure.lang.ExceptionInfo: Call to #'ranged-rand did not conform to spec:
  ;; val: {:start 8, :end 5} fails at: [:args] predicate: (< (:start %) (:end %))
  ;; :clojure.spec/args  (8 5)
  ----
  
  The error fails the second args predicate that checks `(< start end)`. 
  
  Instrumentation of spec'ed functions can also be turned on more widely using the `instrument-all` function. Instrumentation can be turned off using the complementary functions `unstrument` or `unstrument-all`. It's up to you when to use instrumentation and how much. You may want a lot of instrumentation when working at the REPL and different instrumentation at test time. 
  
  Instrumentation only checks the `:args` spec on a function, catching invalid calls external to the function. To validate that the function actually works as intended, you should test your function using the additional tools in `clojure.spec.test`. More on that after we talk about generators!
  
  == Higher order functions
  
  
negative.code: [source,clojure]
  ----
  (s/explain-data ::name-or-id :foo)
  ;;=> #:clojure.spec{
  ;;     :problems ({:path [:name], 
  ;;                 :pred string?,
  ;;                 :val :foo,
  ;;                 :via [:spec.examples.guide/name-or-id],
  ;;                 :in []}
  ;;                {:path [:id],
  ;;                 :pred int?,
  ;;                 :val :foo,
  ;;                 :via [:spec.examples.guide/name-or-id],
  ;;                 :in []})}
  ----
  
  [NOTE]
  ====
  This result also demonstrates the new namespaced map syntax added in 1.9.0-alpha8. Maps may be prefixed with #: or #:: (for autoresolve) to specify a default namespace for all keys in the map. In this example, this is equivalent to `{:clojure.spec/problems ...}`
  ====
  
  == Entity Maps
  
  