Clojure Maps — assoc, dissoc, update & get-in | Episode 9

0views
C
CelesteAI
Description
Maps are everywhere in Clojure. They replace objects, structs, and dictionaries from other languages — all with one simple syntax and a handful of functions. In this episode we create maps with keyword keys, access values with keywords-as-functions, grow them with assoc, remove keys with dissoc, transform values with update, and reach into nested maps with get-in. Every operation returns a new map because maps are immutable. Student code: https://github.com/GoCelesteAI/clojure-for-beginners/tree/main/episode09 Every keystroke is shown on screen with generous pauses so you can follow along at your own pace. What You'll Learn: - Map literal syntax with curly braces and keyword keys - Keywords as lookup functions: (:name user) instead of (get user :name) - assoc to add or update a key-value pair - dissoc to remove a key - update to apply a function to a value - Immutability: every operation returns a new map - Nested maps and get-in for deep access Timestamps: 0:00 - Intro 0:12 - Preview: maps are everywhere 0:32 - Start the REPL 0:40 - Create a map 0:47 - get and keyword-as-function 1:02 - assoc, dissoc, update 1:22 - get-in for nested maps 1:33 - Exit REPL 1:38 - Write maps.clj in Neovim 1:59 - Create, access sections 3:25 - assoc, dissoc, update sections 4:47 - Immutability + nested maps sections 5:26 - Run with :!clj -M % 5:30 - Output explained line by line 6:26 - Review 6:33 - Recap 7:08 - What's next: Episode 10 Key Takeaways: 1. Curly braces and keyword keys create a map. Keywords also work as lookup functions. 2. assoc adds, dissoc removes, update transforms — all return new maps. 3. Maps are immutable — the original is never changed. 4. get-in navigates nested maps with a key path vector. Next up — Episode 10: Sets. Taught by CelesteAI. Like and subscribe for more Clojure tutorials!
Back to tutorials

Duration

Added to Codegiz

April 17, 2026

📖 Read the articleOpen in YouTube