Clojure deps.edn & Your First Script — Phase 1 Finale | Episode 6
0views
C
CelesteAI
Description
Time to move from the REPL to a real project. In this episode we create a project with deps.edn, write a namespace with a -main entry point, and run it from the command line with clj -M -m.
This is the final episode of Phase 1: REPL and First Values. By the end, you will have a project that takes command-line arguments and greets each one.
Student code: https://github.com/GoCelesteAI/clojure-first-script
Every keystroke is shown on screen with generous pauses so you can follow along at your own pace.
What You'll Learn:
- deps.edn as the project config file
- :paths tells Clojure where source files live
- Namespace-to-path mapping (hello.core becomes src/hello/core.clj)
- The -main function as the entry point
- and-args for variadic command-line arguments
- clj -M -m hello.core to run a namespace
- doseq to loop through arguments
- Switching files in Neovim with :e
Project structure:
my-app/
deps.edn {:paths ["src"]}
src/hello/core.clj (ns hello.core) + (defn -main ...)
Timestamps:
0:00 - Intro
0:12 - Preview: from REPL to project
0:32 - Create project directories
0:44 - Write deps.edn
1:00 - Write src/hello/core.clj
1:13 - Namespace declaration
1:23 - greet helper function
1:38 - The -main entry point
2:18 - First run: clj -M -m hello.core (no args)
2:50 - Output explained
3:14 - Second run with Alice and Bob
3:48 - Output explained (with args)
4:30 - Review deps.edn and core.clj
4:47 - Recap
5:15 - What's next — Phase 2 begins
Key Takeaways:
1. deps.edn is the only config file you need. {:paths ["src"]} tells Clojure where source lives.
2. -main is the entry point. The dash is part of the name. and-args captures command-line input.
3. Namespace maps to file path: dots become slashes, hyphens become underscores in filenames.
4. Phase 1 is complete! You know the REPL, syntax, values, functions, conditionals, and project structure.
Series Roadmap:
- Episodes 1-6: REPL and first values (COMPLETE)
- Episodes 7-13: Collections and sequences
- Episodes 14-19: Functional core
- Episodes 20-24: Namespaces, projects, testing
- Episodes 25-30: State and concurrency
- Episodes 31-35: Data modeling
- Episodes 36-38: Macros
- Episodes 39-41: Interop, Babashka, uberjars
- Episodes 42-45: Capstone — web app deployment
Next up — Phase 2 begins with Episode 7: Vectors.
Taught by CelesteAI. Like and subscribe for more Clojure tutorials!