Clojure.spec.gen under the headlamp – quick demo of Gorilla REPL and Huri

Gorilla REPL and Huri were new to me three weeks ago.

I created this worksheet to share some of my initial enthusiasm:

http://viewer.gorilla-repl.org/view.html?source=github&user=glts&repo=spelunc&path=ws/spelunc.clj

Thank you for reading.

9 Likes

Really cool post! Thanks for sharing!

I ran into the issue with bounded #inst generating tons of lower bound values. Are there any tools to help you write generators with other distributions?

I started working with Gorilla as well, but I couldn’t get Huri working on it. Is it possible to see your project.clj?

Thank you for your comment, @splayemu!

I don’t know about tools for writing custom generators, but for the specific case of inst distribution there is a ticket in Jira, https://dev.clojure.org/jira/browse/CLJ-2179. There Gary Fredericks recommends generating the components year, month, day, etc. separately and combining them with gen/fmap. test.check does have generators with uniform distribution so presumably the idea is to create a custom generator for bounded insts and attach it to a spec (I haven’t tried it though).

@alanmarazzi sure, the project is at https://github.com/glts/spelunc. The problem with Gorilla REPL is that you currently have to build your own snapshot to make it work with Clojure 1.9 (as far as I know). And Huri needs a working R installation, the huri.plot stuff is really just a Clojure facade of the ggplot2 library.

Thanks! No problems on the R side (I already use it), I think I have a versioning issue: Clojure 1.8, lein-gorilla 0.4.0 and I the latest Huri.

Later I’ll try to upgrade everything and build Gorilla from source and let’s see what happens

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.