Blackjack with Clojure - Part 2

This is the second of two posts using Clojure to make a simple blackjack program, in the previous post we made a hand, deck and a way to get the face value of the card. We will build on this to include scoring and the actual game logic. Building on where we finished last time, getting the value of individual cards, we will make a function to get the score of multiple cards. The easiest way to do this is to use our get-value function with map and then reduce to get the combined total: ...

July 23, 2025 · 3 min · 572 words · Me

Blackjack with Clojure - Part 1

One of the first small projects I like to do when learning a new language is to model a deck of cards. It’s a good way to familiarise yourself with the basics of language, such as data structures and flow control, once you have a functioning card deck you can take it a step further and model a game like poker or blackjack. As part of my Clojure learning, I have been playing around a bit and thought it would be fun to model the card game blackjack. ...

July 20, 2025 · 3 min · 589 words · Me

TIL about threading in Clojure

Clojure has an incredble range of functions and macros in its core library - just look at them all! While I don’t expect to ever learn them all by heart, there are some that I’ve figured are important for shaping how you breakdown a problem with Clojure. I’ve particularly enjoyed improving my understanding of the threading macros -> and ->> (There are others, such as some->, but I’m yet to use them myself). ...

June 10, 2025 · 2 min · 256 words · Me

TIL how to use Java spatial libraries in Clojure

Being able to utilise Java libraries through interop is a really powerful Clojure feature. One such example that I’ve been using recently is Geotools, a geospatial library - specifically, I have been usign it to create and write to a GeoPackage.. This post will quickly run through the basics of accessing Java libraries through Clojure - this will be followed by another post showing how to use this library to create a GeoPackage. ...

June 9, 2025 · 2 min · 375 words · Me

TIL how to destructure with clojure

This isn’t strictly a “TIL” but it seemed like a good place to start as I’ve recently started learning Clojure for a work project. Compared to a language like Python the syntax is radically different, most code written in Clojure comes in what is known as a form - a statement contained within parentheses, for example: (+ 2 (* 2 2)) ;; 6 One aspect I’ve found particularly challenging is the syntax around destructuring of maps and vectors within a let form. let is what is known as a special form and is used to bind a data structure to a symbol that is usable within the scope of the let form. For example: ...

June 8, 2025 · 2 min · 413 words · Me