我已经编写了以下代码
(defn create [title url]
(when (not-any? clojure.string/blank? '(title url))
(println "doing stuff")))
然而,当我调用函数时
(create "title" "url")
我得到以下错误,无法弄清楚我做错了什么
ClassCastException clojure.lang.Symbol cannot be cast to java.lang.CharSequence clojure.string/blank? (string.clj:279)
这也是我刚开始学习clojure时遇到的问题之一。基本上,你应该使用
(list title url)
clojure编译器处理
'(title url)
作为
(quote (title url))
"quote"不计算其内部的任何内容,因此"title"one_answers"url"只是符号(确切地说是clojure.lang.symbols)。
这里有一个比我更好的解释:http://blog.8thlight.com/colin-jones/2012/05/22/quoting-without-confusion.html