Make sure to add '[org.clojure/test.check "0.9.0"]]' dependency before trying the "generative examples" (starting ~8:00). Check clojure.org/guides/spec#_project_setup
I've transcribed the code here: github.com/Biserkov/spec-screencasts I've made a few minor changes so the code can be run right away but I've stayed as close to the original as possible.
Pretty similar to what dependent type systems do. Also a cut and paste from Racket's contracts. Sadly as any optional type system, there is not compiler to enforce this constraints, leaves too much responsibility in the hands of the humans. Not to mention that with this approach it seems you have to pay on performance for the extra checking.
Make sure to add '[org.clojure/test.check "0.9.0"]]' dependency before trying the "generative examples" (starting ~8:00).
Check clojure.org/guides/spec#_project_setup
Interesting. You are basically programming your own type system. Which allows you to do more than just checking types.
I've transcribed the code here: github.com/Biserkov/spec-screencasts
I've made a few minor changes so the code can be run right away but I've stayed as close to the original as possible.
Great walkthrough, thanks!
Check out liquid types in Haskell for other examples of refinement types.
nice!!
Pretty similar to what dependent type systems do. Also a cut and paste from Racket's contracts. Sadly as any optional type system, there is not compiler to enforce this constraints, leaves too much responsibility in the hands of the humans. Not to mention that with this approach it seems you have to pay on performance for the extra checking.