Skip to content

Instantly share code, notes, and snippets.

@olivergeorge
Created April 24, 2017 00:45
Show Gist options
  • Save olivergeorge/45339f8d5b4c3eda9ccf12387cd4a917 to your computer and use it in GitHub Desktop.
Save olivergeorge/45339f8d5b4c3eda9ccf12387cd4a917 to your computer and use it in GitHub Desktop.
Quick hacky example of using https://github.com/stathissideris/spec-provider to infer types.
(def example-data (atom {:args #{} :ret #{}}))
(defn record-example [k v]
(js/console.debug ::record-example [k v])
(swap! example-data update k conj v)
v)
(s/fdef dsl/build-model
:args (partial record-example :args)
:ret (partial record-example :ret))
(comment
(->> @example-data :args count)
(->> @example-data :args (map first) count)
(->> @example-data :args (map first) first)
(spec-provider.provider/pprint-specs
(spec-provider.provider/infer-specs
(->> @example-data :args (map first) (take 5))
::model-spec)
'toy
's)
(->> @example-data :args (map first) (map :field-spec) (mapcat vals) (take 5))
(spec-provider.provider/pprint-specs
(spec-provider.provider/infer-specs
(->> @example-data :args (map first) (map :field-spec) (mapcat vals))
::field-spec-map)
'toy
's))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment