This is always the first tiny baby step when learning a programming language. Let’s try “Hello, World!” in Clojure.
Start repl. When you use Leiningen, type lein repl
on Terminal (Command Prompt):
Type below on repl:
Advice to coaches
If this is the first Clojure code, please explain Clojure’s syntax: parenthesis, function, argument, etc.
Explain the different functions above, if necessary. For example, prn
is for reader
, while println
is for human consumption.
Create a brand new Clojure project:
Add main
to project.clj
(line 7):
Edit src/helloworld/core.clj
to look like below:
Run the program:
Advice to coaches
This is an optional lab work. After it is tried, explain the moving parts of a Clojure project, such as project.clj
and namespaces. You don’t have to explain it in detail, because other labs will cover those topics. This lab is to get familiar with Clojure programming.