Clojure Coding Style Guide

Back to SIG Clojure Tutorials

Widely Accepted Style Norms

The following guide is a great reference for the coding style that we follow here at SIG. It's fairly long, but worth the read.

The Clojure Style Guide

SIG-specific Style Practices

We decide to align columns in situations such as hash-maps, require statements, and let statements. For example:

{:workspace   workspace
 :layer-group ""
 :forecast    forecast
 :filter-set  #{"fuels" model layer "20210407_000000"}
 :model-init  "20210407_000000"
 :hour        0}

(ns pyregence.cameras
  (:require [clojure.data.json :as json]
            [clj-http.client   :as client]
            [triangulum.config :refer [get-config]]
            [pyregence.views   :refer [data-response]]))

(let [[workspace layer]   (str/split name-string #":")
      [forecast type]     (str/split workspace #"_")
      [filter model-init] (str/split layer #"_(?=\d{8}_)")]