Let's try creating a simple program using basic development tools.
- Prerequisite: Clojure development environment setup
Creating the First Program in Clojure
Leiningen is one of the best tools for managing Clojure projects.
You can scaffold a new app project using lein new
:
$ lein new app first-program
Generating a project called first-program based on the 'app' template.
$ cd first-program/
$ ls
CHANGELOG.md LICENSE README.md doc project.clj resources src test
Here's a generated clojure source file, src/first_program/core.clj:
(ns first-program.core
(:gen-class))
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World!"))
You can build and run the program using the lein run
command:
$ lein run
Hello, World!
C C++ C# Crystal D Dart Erlang F# Go Haskell Java Javascript Julia Kotlin Lua Python Rust Scala Swift Typescript