How do you evaluate Java. Net in clojure lang.String

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
分享
二维码
< <上一篇
下一篇>>