Clojure is a modern programming language that is designed to be simple, efficient, and highly expressive. It is a dialect of Lisp, which is a family of programming languages that are known for their powerful macro system and functional programming features. Clojure is a dynamic language that runs on the Java Virtual Machine (JVM), which means that it can take advantage of the vast ecosystem of Java libraries and tools.
Clojure also has a strong emphasis on simplicity and elegance. The language is designed to be concise and expressive, which makes it easy to write and read code. Clojure also provides a number of powerful abstractions, such as macros and higher-order functions, that allow developers to write code that is both concise and expressive.
This cheat sheet provides a quick reference for Clojure syntax and functions.
Data Types
Data Type
Description
nil
Represents the absence of a value
boolean
Represents true or false
number
Represents numeric values
string
Represents text
keyword
Represents a unique identifier
symbol
Represents a reference to a value
list
Represents a sequence of values
vector
Represents an ordered collection of values
map
Represents a collection of key-value pairs
set
Represents a collection of unique values
Variables
Syntax
Description
(def name value)
Defines a new variable with the given name and value
(defn name [args] body)
Defines a new function with the given name, arguments, and body
(let [bindings] body)
Defines local variables with the given bindings and evaluates the body
Control Flow
Syntax
Description
(if condition true-branch false-branch)
Evaluates the true-branch if the condition is true, otherwise evaluates the false-branch