私はclojureファイルに次のものを持っています:
(ns helloworld
(:gen-class
:main -main))
(defn hello-world-fn []
(println "Hello World"))
(defn -main [& args]
(eval (read-string "(hello-world-fn)")))
と私はそれを実行しています
lein run helloworld
次のエラーが表示されます。
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol:
helloworld in this context, compiling:(helloworld.clj:12)
私は ns-resolve
や resolve
で何かをする必要があると感じましたが、何の成功もありませんでした。私は主な機能で次のことを試しました:
(let [call-string (read-string "(hello-world-fn)")
func (resolve (symbol (first call-string)))
args (rest call-string)]
(apply func args))
成功なし。
誰か(a)が私を正しい方向に向けることができますか? (b)Clojureの読者が何が起こっているのかを正確に説明してください。