0

Here's my core code (sorry, some parts are in Portuguese)

(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)

I'm using cider, lein and Emacs. I haven't changed the project.clj. It was working yesterday (really).

If needed, I may provide more datails.


Edit

I tried lein run as suggested and I received

Unable to resolve symbol: filename in this context, compiling:(prova1_ed/core.clj:8:18)

filename was supposed to be the read-line result.

Drew
  • 29,895
  • 7
  • 74
  • 104
Tiago Dall'Oca
  • 329
  • 3
  • 15

1 Answers1

0

The error is on (defn lista '()). It should be (def lista '()).

It's working know.

(It's hard to debug using Emacs)

Thanks!

Tiago Dall'Oca
  • 329
  • 3
  • 15