Clojure Submaps

The gentleman behind Clojure Diary was kind enough to recently post a video based on a small comment I made on his YouTube channel: Clojure Diary - Elegant way of filtering maps based on key value pairs.

(Please check out his channel as he’s doing a great job regularly posting videos about his journey through Clojure!)

In my comment I used a little submap? function from my personal utilities library that I’ve gotten a lot of mileage out of the last year or two.

I thought I’d mention it here. It’s isn’t anything magical, but I think it’s part of my personal standard library from here on out:

Chinese Zodiac Time for Emacs

In the spirit of Chinese New Year, I hacked up a small extension for Emacs to render the current time of day using emoji and Chinese characters:

Various screenshots of Emacs showing the time displayed with Chinese characters and emoji.

Various configurations for your mode line.

Fix clj-refactor Libspec Stealing

(This post is regarding a very particular issue at the intersection of Emacs, Clojure, and CIDER, so most readers can probably skip it, but I figured the solution deserved to be somewhere on the internet.)

CIDER has this awesome feature via clj-refactor where it can automatically add missing libspecs to your ns form as soon as you type an aliased var name using an :as alias you have previously used for that namespace:

Screen recording showing how CIDER and clj-refactor can add missing libspecs.

Screen recording showing how CIDER and clj-refactor can add missing libspecs.

You can define a preferred set of (:as) aliases via cljr-magic-require-namespaces in your Emacs config, and, whether you’ve done that or not, CIDER tries hard to be smart, offering you choices if you’ve previously used the same alias for different namespaces in different places in your project (e.g. s/ for clojure.spec some places and the same for clojure.string in other places).

Moreover, CIDER evaluates the namespace form, bringing in the new requires, allowing you to just keep typing and coding, without breaking your flow.

This is all fantastic, but I ran across one particular scenario where this kept biting me: my user namespace.

Clojure Thread Dump

From the department of How Did I Never Learn This in 12+ Years of Clojure? comes today’s tip:

Did you know you can generate a thread dump (+ memory usage information) from a Clojure REPL with a single keystroke? I sure didn’t.

Notes on Upgrading Datomic On-Prem to v1.0.6726

After the news from the Clojure/conj that Datomic is now free, I was excited to get home and upgrade and access newer features and high-availability. Herein are notes from how that upgrade process went that I hope will be helpful to anyone else upgrading, including difficulties I had running the official Datomic AMIs.