A Real-World Example

While it’s great to talk about the different interop cases and learn how to eke out some additional performance using Java’s primitive forms, you still need to have some practical, hands-on knowledge. In this example, we will be building an application to test the availability of websites. The goal here is to check to see whether the website returns an HTTP 200 OK response. If anything other than our expected response is received, it should be marked as unavailable.

Again, we will use the Leiningen build tool. Refer to Clojure Coding Quick Start if you don’t have Leiningen installed already. Let’s start by creating a new project:

 ​lein new pinger​

Open your project.clj file and modify the contents to match what we ...

Get Programming Clojure, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.