How do you evaluate Java. Net in clojure lang.String
•
Java
How would I rate the following?
(defn run-clojure-func [] (println "welcome")) (defn -main [& args] (eval (*func* (first args))) java exam.Hello "run-clojure-func"
Solution
You need to consider two versions – identical, but useful as a point of comparison:
(defn -main [& args] ((-> args first symbol resolve)))
For this, destructuring is used instead of - > macro. Usage:
(defn -main [[fn-name]] ((resolve (symbol fn-name))))
Determination is clearly the key Document is your friend.: -) In addition, as an unfair generalization, Eval hardly needs
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码