(ns learning.hello
  (:gen-class))The :gen-class directive in the ns declaration tells Clojure to generate a named Java class when it compiles the namespace.
You can compile in the repl !!
user=> (load "learning/hello")| (pprint (loaded-libs)) | 
| user=> (System/getProperty "java.class.path") | |
| "/some/path/clojure/clojure.jar" | |
| user=> (System/setProperty "java.class.path" ".:/some/path/clojure/clojure.jar:/some/other/lib.jar") | |
| ".:/some/path/clojure/clojure.jar:/some/other/lib.jar" | |
| user=> (def cl (-> (Thread/currentThread) (.getContextClassLoader))) | |
| #'user/cl | |
| user=> cl | |
| #<DynamicClassLoader clojure.lang.DynamicClassLoader@19c5466b> | |
| user=> (-> cl (.addURL (java.net.URL. "file:///some/other/lib.jar"))) | |
| nil | 
| import java.util.Arrays; | |
| import java.util.Iterator; | |
| import clojure.lang.IFn; | |
| import clojure.lang.LazySeq; | |
| import clojure.lang.RT; | |
| public class Main { | |
| public static void main(String[] args) { | 
(ns learning.hello
  (:gen-class))The :gen-class directive in the ns declaration tells Clojure to generate a named Java class when it compiles the namespace.
You can compile in the repl !!
user=> (load "learning/hello")| (defnk net-present-value | |
| "(net-present-value :rate 0.05 :cashflows [-1000 500 600 800])" | |
| [:rate :cashflows] | |
| (reduce + (map #(/ %1 (pow (inc rate) %2)) cashflows (range)))) | 
| x: item | |
| n: a number | |
| m: map | |
| v: value | |
| k: key | |
| i: index | |
| c: char | |
| t: tree | |
| f: function | 
| (.format (java.text.SimpleDateFormat. "yyyy-MM-dd") (java.util.Date.)) | 
\w is the same as [a-zA-Z0-9]
hello
| (dont cheat) |