clojure - 无法获取宏的值(clojure)

标签 clojure compiler-errors

在这一段clojure代码中:

(defn makeStructs ;line 27
 "open fName as a file and turns each line into a struct. Returns a Vector of structs"
 [fName]
   with-open[r (reader (file fName))]
   (let [r 
      res (doall (map makeStruct (line-seq r)))
      ]    
  (. r close)
     res
  ) 
)

我收到此编译器错误:
Exception in thread "main" java.lang.Exception: Can't take value of a macro: #'clojure.core/with-open (clojureHW.clj:27)

上面注释了第 27 行。

知道问题是什么吗?

最佳答案

你需要实际调用宏,

(defn makeStructs ;line 27
 "..."
 [fName]
   (with-open ; note the extra paren

关于clojure - 无法获取宏的值(clojure),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5751262/

相关文章:

excel - 语法错误CountIfs函数多个条件

Clojure:部分更改 Enlive 中的属性值

postgresql - 如何通过比较 SqlKorma (clojure) 中的两个字段来创建 where 子句

javascript - 有选择地展平嵌套 JSON 结构

compiler-errors - 如何在64位RaspberryPi中编译32位ARM?

c++ - 初始化列表不工作 xCode 4.4

data-structures - 无限数据结构有哪些引人注目的用例?

multithreading - 当我在 Clojure 中定义来自多个线程的变量时会发生什么?

C++ 错误 C2059

compiler-errors - 如何从NVIDIA CG获得编译错误?