How would I eval to the following?
(defn run-clojure-func []
(println "welcome"))
(defn -main [& args]
(eval (*func* (first args)))
java exam.Hello "run-clojure-func"
How would I eval to the following?
(defn run-clojure-func []
(println "welcome"))
(defn -main [& args]
(eval (*func* (first args)))
java exam.Hello "run-clojure-func"
Two versions for you to consider – entirely equivalent, but useful as points of comparison:
(defn -main [& args]
((-> args first symbol resolve)))
and this, using destructuring and no ->
macro usage:
(defn -main [[fn-name]]
((resolve (symbol fn-name))))
resolve
is obviously the key. The docs are your friend. :-) Also, as an unfair generalization, eval
is almost never necessary.