这是我的核心代码(对不起,有些部分是葡萄牙语)
(ns prova1-ed.core
(:gen-class))
(use 'clojure.java.io)
(defn getFile []
(let [filename (read-line)]
(if (.exists (java.io.File. filename))
filename
(do
(println "Nome de arquivo inválido. Digite novamente:")
(recur)))))
(defn getFileLines [^String filename]
(defn lista '())
(with-open [rdr (reader filename)]
(doseq [line (line-seq rdr)]
(if-not (= "" line)
(concat lista '(line)))
))
lista)
(defn -main [& args]
(println "Olá! Digite um arquivo contendo as contas bancárias:")
(getFileLines (getFile)))
prova1-ed.core> (-main)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: -main in this context, compiling:(C:\Users\Tiago\AppData\Local\Temp\form-init296650600503762010.clj:1:1)
我正在使用苹果酒、lein 和 Emacs。我没有更改project.clj。它昨天工作(真的)。
如果需要,我可能会提供更多数据。
编辑
我按照建议尝试lein run
了,我收到了
Unable to resolve symbol: filename in this context, compiling:(prova1_ed/core.clj:8:18)
filename
应该是read-line
结果。