I have just begun learning clojure and I'm using the Textmate editor for writing the scripts. However, I am not able to figure out how to run it from the terminal. Like I type the clj filename.clj command but nothing happens. Do I need to include the function name also somewhere because I have a function that takes a number as an argument.
Here is my code that I want to run from the terminal:
(defn next-collatz-num [n]
(if (even? n)
(quot n 2)
(inc (* n 3))))
(defn collatz [n]
(take-while #(< 1 %)(iterate next-collatz-num n)))
(defn max-count-collatz [n]
(when (> n 0)
(first
(reduce
#(if (> (last %1)(last %2)) %1 %2)
[1 1] (map #(list % (count (collatz %))) (range 1 (inc n)))))))
(max-count-collatz 999999)