Clojure

Clojure

Installation

required bash, curl, rlwrap and Java

Ubuntu
apt install clojure
Arch Linux
pacman -S clojure
Binary
# https://clojure.org/guides/getting_started
curl -O https://download.clojure.org/install/linux-install-{version}.sh
chmod +x linux-install-{version}.sh
sudo ./linux-install-{version}.sh

Examples

Fibonacci Numbers
; Fibonacci Numbers
(defn fib [n]
  (if (< n 2)
    n
    (+ (fib (- n 2)) (fib (- n 1)))))

(println (fib (Integer/parseInt (nth *command-line-args* 0))))

(comment
  example
    run
      clojure -M fib.clj 30
)