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 build 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, the website should be marked as unavailable.

Again, we’ll use the clj build tool. Refer to Clojure Coding Quick Start if you don’t have clj installed already. Let’s start by creating a directory to hold our project and switch to it:

 mkdir pinger
 cd pinger

You can start a REPL for the pinger project ...

Get Programming Clojure, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.