megan-zk
analysis

Defining Constants in Clojure

The def operator binds a name to a value.

(def constant-name constant-value)

In clojure, data structures are immutable – they cannot be reassigned. Therefore, when defining a value name, treat the value as a constant and not a variable, as is typical in other languages.

see also

references

  1. Higginbotham, Daniel. Clojure for the Brave and True Learn the Ultimate Language and Become a Better Programmer. Daniel Higginbotham, 2015, [https://www.braveclojure.com/clojure-for-the-brave-and-true/].