Journal 2019.6 - spec

Survey results

Spent some time last week writing up, editing, and releasing the 2019 State of Clojure survey results. I also wrote in the prior entry some feedback on a number of the open feedback comments.

spec

Finished up the work this week on support for creating simpler custom spec ops this week and it’s now in spec-alpha2 as s/defop. One good example comes from Sean Corfield - bounded-string, a string with length in a specified range:

(require '[clojure.spec-alpha2 :as s] '[clojure.spec-alpha2.gen :as gen])

(s/defop bounded-string
  "Specs a string with bounded size (<= min (count string) max)"
  [min max]
  (s/and string? #(<= min (count %) max)))

user=> (s/def ::first-name (bounded-string 1 20))
:user/first-name
user=> (s/form ::first-name)
(user/bounded-string 1 20)
user=> (s/conform ::first-name "Homer")
"Homer"
user=> (s/explain ::first-name "")
"" - failed: (<= 1 (count %) 20) spec: :user/first-name

Still working through a few issues from Sean Corfield and Michiel Borkent who have been doing a great job testing things out, but they both have their full code and tests working with spec 2.

I have determined that the ideal number of active consumers of your code is 2.

Next, I’m starting to work on some of the pull-like select syntax.

Odds and ends

  • I’ve been doing what I can to help Elana Hashman and the Debian Clojure team as they sort through some packaging issues. Big thanks to her and the rest of the team for all of their tireless efforts getting the latest Clojure into the next release!
  • Did a bunch of minor clojure-site merges and updates

Other stuff I enjoyed this week…

My daughter was the costume director for her high school production of Evil Dead The Musical this week, so I caught that twice. Fun show, lot of stage blood. :)

Written on February 10, 2019