Re: code from spec with clojure.spec?

2016-11-07 Thread Alex Miller
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

Re: code from spec with clojure.spec?

2016-11-06 Thread Joe Corneli
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

code from spec with clojure.spec?

2016-10-17 Thread Joe Corneli
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]}