Things that make Clojure beautiful: namespace declarations

(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: lawrence@krubner.com

In Python, and Java, the import statements at the top of the file are big jumble of disorganized statements. In Clojure the namespace declaration is a data structure that can be cleaned up using all the tools Clojure has for working on a data structure. Apparently that is the idea behind Slamhound, which detects when imports are not being used. That is clever. I did not know about Slamhound. I will have to check that out.

Also this:

which was generating this warning:

WARNING: update already refers to: #’clojure.core/update in namespace:
carouselapps.db.core, being replaced by: #’korma.core/update

What now? I thought I was going to spend the next two hours figuring out a clean way to deal with this, but nope, it took 5 minutes to figure out I could just rename korma.core/update as I was requiring it:

(ns carouselapps.db.core
(:require
[korma.core :refer :all :rename {update sql-update}]
[korma.db :as db]
[environ.core :refer [env]]
[to-jdbc-uri.core :refer [to-jdbc-uri]]))

This is the kind of real world pragmatism that you rarely see in programming languages, specially those rooted in academic practices, like being a Lisp, which Clojure is.

Source