Core Data Structures & Syntax
Explore Clojure's fundamental data structures like lists, vectors, maps, and sets, along with basic syntax.
Core Data Structures & Syntax is a free Clojure Functional Programming & JVM Backend Development lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Clojure Functional Programming & JVM Backend Development learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Clojure's Building Blocks
Now the core: Clojure's fundamental data structures and the simple syntax that makes it so expressive.
S-Expressions: The Core Syntax
Clojure is built from S-expressions: parenthesized lists where the first element is a function and the rest are its arguments. Everything is an expression.
Basic Literals: Numbers & Strings
The basic literals are numbers, double-quoted strings, and the booleans true/false — each evaluates to itself.
(ns coddykit.core
(:gen-class))
(defn -main
"Basic literals in action."
[& args]
(println 123)
(println "Hello, CoddyKit!")
(println true))Lists: Ordered & Flexible
A list in parentheses is treated as a function call by default. To make it data, quote it with an apostrophe like '(1 2 3).
Vectors: Indexed & Efficient
Vectors use square brackets and are zero-indexed. Prefer them over lists when you want fast positional access.
(ns coddykit.core
(:gen-class))
(defn -main
"Lists and Vectors demo."
[& args]
(let [my-list '(apple banana cherry)
my-vec [10 20 30]]
(println "First list item:" (first my-list))
(println "Second vector item:" (nth my-vec 1))))Maps: Key-Value Pairs
Maps store key-value pairs in curly braces, usually with keyword keys like :name — perfect for structured data.
Sets: Unique & Unordered
A set in #{} holds unique, unordered items and silently drops duplicates. Ideal for fast membership checks.
Keywords: Self-Evaluating Identifiers
Keywords start with a colon, like :email. They are self-evaluating constants, used everywhere as efficient map keys.
(ns coddykit.core
(:gen-class))
(defn -main
"Maps, Sets, and Keywords demo."
[& args]
(let [person {:name "Alice" :age 30 :city "London"}
skills #{"Clojure" "Java" "SQL"}]
(println "Person's name:" (:name person))
(println "Has Clojure skill?" (contains? skills "Clojure"))))Symbols: Referring to Things
A symbol is a name that refers to a variable or function. Clojure resolves it on evaluation; quote it ('sym) to treat it as data.
Quick Check: Clojure Structures
Which of the following Clojure data structures is best suited for storing a collection of unique items where order doesn't matter?
Recap: Core Data & Syntax
Recap: S-expressions drive the syntax, with lists, vectors, maps, sets, keywords, and symbols as your core building blocks.
Frequently asked questions
Is the “Core Data Structures & Syntax” lesson free?
Yes — the full text of “Core Data Structures & Syntax” is free to read here on the web, and the Clojure Functional Programming & JVM Backend Development course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Clojure Functional Programming & JVM Backend Development course, upgrade to CoddyKit PRO.
What will I learn in “Core Data Structures & Syntax”?
Explore Clojure's fundamental data structures like lists, vectors, maps, and sets, along with basic syntax. You practise Clojure Functional Programming & JVM Backend Development with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Clojure Functional Programming & JVM Backend Development?
No prior experience is required. Clojure Functional Programming & JVM Backend Development on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Core Data Structures & Syntax” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Clojure Functional Programming & JVM Backend Development lesson?
Yes. Every Clojure Functional Programming & JVM Backend Development lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Introduction to Clojure & JVM
- Core Data Structures & Syntax
- REPL-Driven Development Workflow
- Destructuring and Working with Keywords