On Monday, October 17, 2016 at 5:51:42 PM UTC-5, Joe Corneli wrote:
>
> As a running example related to the ideas in
> http://clojure.org/guides/spec#_spec_ing_functions, please consider the
> following function:
>
> (defn mapper [x y]
> {:tacos (vec (range x))
>:burritos (vec (range
This is a late reply to my own question but maybe it will be helpful to a
future searcher.
http://blog.cognitect.com/blog/2016/10/5/interactive-development-with-clojurespec
has an example that showed me more clearly how to use :fn.
Specifically here's how I rewrote the spec:
(s/fdef mapper
As a running example related to the ideas in
http://clojure.org/guides/spec#_spec_ing_functions, please consider the
following function:
(defn mapper [x y]
{:tacos (vec (range x))
:burritos (vec (range y))})
Example input and output:
(mapper 2 4) ;=> {:tacos [0 1], :burritos [0 1 2 3]}