Over the past 4 years I've had the fortune of working full time in Clojure. The backend for the Relish mobile app is built in Clojure. It runs on Heroku and we use lein as our build tool. This has been a great development experience. But, for the next Clojure project I wanted to try tools.deps and tools.build. Unfortunately, there isn't an official Heroku buildpack and none of the unofficial alternatives were quite what I was looking for. In the end I decided to roll my own to get comfortable with Heroku's build pack API.
Recently I stumbled over an old Java project from 2011. I wanted to see if I could get it to run. However, the original program had a bunch of IDE related build files that I no longer understood. What if I used Clojure to build the project? The fruit of that journey is covered in this blog post.
Say you are making a digital advent calendar app. You want users to get a special reward on the days that they open your app. But only once per day and only on the days they open the app. This sounds straight forward. What about time zones? What about users who open the app on the 1st of December at 23:55 and then on the 2nd of December at 00:03? Time is tricky.
Emacs is an interactive, self-documenting and extensible elisp interpreter. This makes it surprisingly enjoyable to extend. It goes something like this: you notice some friction when using a command, you use Emacs' self-documenting features to learn about the command, you investigate the source, you write some elisp, you evaluate it and you try the new and improved command out (all without ever having to restart Emacs).
I've always wanted to build Emacs from source as it lets you try new features. Native compilation in particular was something I wanted to explore. Native compilation leverages libgccjit to compile Emacs lisp code to native code making Emacs very snappy.
When I changed the styling of this website I removed code highlights as part of an exercise in minimalism. Anyway, I recently read this awesome article about writing a Clojure highlighter from scratch in 160 lines which inspired me to add some very basic highlights back to this site. This post is about implementing my own Clojure highlighter from scratch in 8 lines (and a fraction of the functionality).
Writing a simple website link checker in Clojure for fun and profit. Clojure has this nifty function called re-seq that returns a lazy sequence of successive matches of a pattern in a string we can combine this with recursion to write a primitive website link checker.
Sometimes you want behaviour that differs based on the number of times an item has been seen in a sequence. Clojure doesn't come with a function that does this. Before you say "What about frequencies?", frequencies gives you the total number of occurrences in a sequence of items, not the occurrence count.
Multimethods are fantastic. They give you polymorphism without objects or classes (the best part of Object Oriented without the baggage), multiple dispatch, dynamic dispatch and strong decoupling that allows you to extend code without modifying it (open closed principle), this even extends to third party code. This decoupling is so good that it's not unheard of to deploy your system without all the defmethod extensions being required! This post will teach you how to prevent this.
In this post we'll cover writing a macro that supports destructuring and does something with the bindings. More specifically we will write a macro that makes building maps from arbitrary data less verbose.