This is the second part of a series that explores clojure.spec, property-based testing, and how those tools can be used to test Datomic. Check out part 1 for an introduction to clojure.spec and property-based testing. All of the code from this post is in the example repo
As we discussed in the first post, property-based testing works well for pure functions but that excludes a good chunk of code we would like to thoroughly test such as code that makes updates to a database. I also hinted that Datomic is uniquely suited to be tested by property-based tests.
Continue reading “Property-Based Testing with Clojure and Datomic – Part 2”
This is the first part of a multi-part series that explores clojure.spec, property-based testing, and how those tools can be used to test Datomic. This post serves mainly as an introduction to property-based testing and clojure.spec. Check out part 2 for the introduction of Datomic property-based testing.
Clojure.spec was recently released and the Clojure community is diving into it to see how specs can improve their programs. One of the more interesting design decisions made for clojure.spec is the connection between specs and property-based testing via another Clojure contrib library:
Continue reading “Property-Based Testing with Clojure and Datomic – Part 1”
Protocols are a feature in Clojure and ClojureScript that provide high-performance, dynamic, typed-based polymorphism. That’s a lot of computer words, but what it really means is that Clojure(Script) will help us in creating functions that process in different ways arguments of different types. They are similar to Java Interfaces, but with a few key differences.
Continue reading “Protocols in ClojureScript”
Macros are powerful metaprogramming tools, but they can be difficult to use well. In this article, I share several tips for creating correct, legible, and useful macros in Clojure.
Continue reading “A few tips for writing macros in Clojure”
Here at Altometrics, we often use Amazon Web Services for deploying web applications. Out of the AWS suite of tools, we are very fond of Amazon CloudFormation. CloudFormation provides a way to specify your application’s entire infrastructure in a single, declarative template. The associated tools handle creating and connecting all of the necessary resources (auto scaling groups, load balancers, etc.) at once, as well as updating your stack when the template changes.
But we have one grievance with CloudFormation. The configuration file needs to be formatted as JSON.
Continue reading “Stop Using JSON For Configuration Files”
Abstract: calls to
reduce are difficult to understand. An example
reduce in a code sample is analyzed and discussed to explore the reasons. An alternative version without the
reduce is offered and compared.
Continue reading “Reducing the conceptual load of reduce”
Yesterday, we published a post about limitations of the Om model. Several people responded, including Peter Jaros, Vesa Marttila, Brian J. Rubinton, and Mark Stang. A common suggestion was to use a core.async channel, which is essentially what we did. This post gives more details about the solution we chose.
Continue reading “How We Solved Our Om Problem”
When you’re building a frontend with Om, it gives you a couple of ways to store data. Fundamentally, Om mediates between data (which the user can’t see) and the DOM (which they can). Because of this, it’s important to think about where you keep the data.
Continue reading “A Difficulty with Modals in the Om Model”
We’re big fans of Clojure at Altometrics. It really gets out of the way and lets us get stuff done without a lot of fuss. Like many functional programming languages, Clojure features lazy sequences, which are especially useful if a given sequence is too big to fit into memory. (I’ll call such sequences “large” for the purposes of this post.)
I recently wrote the following Clojure function to lazily
reduce a large sequence. I couldn’t find a Clojure function that does this, so I figured it would be worth sharing. The discussion follows, but first, here’s the code:
Continue reading “Lazy reduce in Clojure”