Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Clojure


1. Clojure
Clojure is a robust, practical, and fast programming language with a set of useful features that together form a simple, coherent, and powerful tool. From the Clojure web site at https://clojure.org/ .

2. CentOS installation
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


3. Check the installed version
I could not find a command to display the installed version (and exit without being in the interactive REPL loop)

4. Hello world in Clojure
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.

5. End of page