Note: Clojure is built on and requires Java. See
Java .
The following Linux command(s) to install Clojure.
sudo yum -y install rlwrap
cd ~
curl -O https://download.clojure.org/install/linux-install-1.10.1.466.sh
chmod +x linux-install-1.10.1.466.sh
sudo ./linux-install-1.10.1.466.sh
I could not find a command to display the installed version (and exit without being in the interactive REPL loop)
The file type of a
Clojure program file is
clj.
The following Linux command(s) create/edit a hello program in the your home directory using the nano text editor.
nano ~/hello.clj
Create the following program text in the editor that will output the text "Hello world"
(defn hello-world []
(println "Hello world"))
(hello-world)
To exit with save, remember to press
Ctrl-X, then "
y" (for yes) and
Enter to exit.
The following Linux command(s) run the program.
clj ~/hello.clj
The output should be as follows.
Hello world
Note: Since Clojure is Java-based and a somewhat sophisticated (read as complicated) system, you may need to wait a while for even a simple "Hello world" program to compile and run.
Personal opinion: To use Clojure for anything other than small test programs, one needs more software, a sophisticated (complex) project-based IDE, and a lot of investment in time and effort to get anything useful out of the experience.