Last active
October 10, 2018 22:18
-
-
Save darwin/e7748419304915f75633666b906f23f8 to your computer and use it in GitHub Desktop.
clojure -Srepro -Sdeps '{:deps {issue {:git/url "https://gist.github.com/darwin/e7748419304915f75633666b906f23f8" :sha "af929e906525703509a4f86ba371d74f8338dc71"}}}' -m main
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:paths ["."] | |
:deps {metosin/spec-tools {:mvn/version "0.7.2"} | |
org.clojure/test.check {:mvn/version "0.9.0"} | |
org.clojure/clojure {:mvn/version "1.9.0"}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns main | |
(:require [spec-tools.core :as st] | |
[clojure.spec.alpha :as s] | |
[clojure.spec.gen.alpha :as gen])) | |
(def raw-spec (s/+ (s/tuple #{:a :b :c} integer?))) | |
(def metosin-spec | |
(st/spec {:spec raw-spec})) | |
(def worked-around-metosin-spec | |
(st/spec {:spec raw-spec | |
:gen #(s/gen raw-spec)})) | |
(defn -main [& args] | |
(println "1." (gen/generate (s/gen raw-spec))) | |
(try | |
(println "2." (gen/generate (s/gen metosin-spec))) | |
(catch Exception e | |
(println e))) | |
(println "3." (gen/generate (s/gen worked-around-metosin-spec)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. ([:b 109632] [:a 3436022] [:c 19434] [:a -1401] [:c -100] [:a 1978152] [:c 21879] [:a 52823884] [:c 10055] [:a -1271189] [:a 6379119]) | |
#error { | |
:cause No implementation of method: :gen* of protocol: #'clojure.spec.alpha/Spec found for class: clojure.lang.PersistentArrayMap | |
:via | |
[{:type java.lang.IllegalArgumentException | |
:message No implementation of method: :gen* of protocol: #'clojure.spec.alpha/Spec found for class: clojure.lang.PersistentArrayMap | |
:at [clojure.core$_cache_protocol_fn invokeStatic core_deftype.clj 583]}] | |
:trace | |
[[clojure.core$_cache_protocol_fn invokeStatic core_deftype.clj 583] | |
[clojure.core$_cache_protocol_fn invoke core_deftype.clj 575] | |
[clojure.spec.alpha$fn__1715$G__1663__1726 invoke alpha.clj 37] | |
[spec_tools.core.Spec gen_STAR_ core.cljc 265] | |
[clojure.spec.alpha$gensub invokeStatic alpha.clj 279] | |
[clojure.spec.alpha$gensub invoke alpha.clj 272] | |
[clojure.spec.alpha$gen invokeStatic alpha.clj 296] | |
[clojure.spec.alpha$gen invoke alpha.clj 285] | |
[clojure.spec.alpha$gen invokeStatic alpha.clj 295] | |
[clojure.spec.alpha$gen invoke alpha.clj 285] | |
[main$_main$fn__920 invoke main.clj 18] | |
[main$_main invokeStatic main.clj 17] | |
[main$_main doInvoke main.clj 15] | |
[clojure.lang.RestFn invoke RestFn.java 397] | |
[clojure.lang.AFn applyToHelper AFn.java 152] | |
[clojure.lang.RestFn applyTo RestFn.java 132] | |
[clojure.lang.Var applyTo Var.java 702] | |
[clojure.core$apply invokeStatic core.clj 657] | |
[clojure.main$main_opt invokeStatic main.clj 317] | |
[clojure.main$main_opt invoke main.clj 313] | |
[clojure.main$main invokeStatic main.clj 424] | |
[clojure.main$main doInvoke main.clj 387] | |
[clojure.lang.RestFn applyTo RestFn.java 137] | |
[clojure.lang.Var applyTo Var.java 702] | |
[clojure.main main main.java 37]]} | |
3. ([:a 27631896] [:b -1] [:a -16745599] [:a -1] [:a 68070] [:a 0] [:a 230523] [:b -1] [:a 390] [:b 213302589] [:c -3309] [:a -27] [:a -159041781] [:c 829904] [:b -1507] [:b 21] [:b 12063284] [:c -2813] [:a 712393] [:a 87379] [:b -47827052]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment