【发布时间】:2021-08-30 22:17:39
【问题描述】:
我正在尝试编写一个宏,以便从 ClojureScript 中使用来处理 Reagent 应用程序的文件 I/O。我收到此错误:
IllegalArgumentException: No implementation of method: :as-file of protocol: #'clojure.java.io/Coercions found for class: clojure.lang.Symbol
当我尝试执行以下操作时:
(def file-string "/Users/luciano/Dropbox/projects/test/resources/blog/test.md")
(get-file file-string)
但我可以做到这一点:
(get-file "/Users/luciano/Dropbox/projects/test/resources/blog/test.md")
这是宏:
(defmacro get-file [fname]
(slurp (io/file fname)))
我在这里做错了什么?
【问题讨论】:
标签: clojure clojurescript